code-snippets

Posting source code in blogger- fails with C# containers

I tried the solutions that are posted in this related SO question and for the most part the code snippets are working, but there are some cases that are still getting garbled by Blogger when it publishes the blog. In particular, declaring generic containers seems to be most troublesome. Please see the code examples on my blog: http://ml...

Any way to surround code block with Curly Braces {} in VS2008?

I always find myself needing to enclose a block of code in curly braces { }, but unfortunately that isn't included in the C# surround code snippets, which seems to be an oversight. I couldn't find anything on building your own surround snippets either (just other kinds of snippets). I am actually running Resharper too, but it doesn't...

Looking for replacement for Snippet Compiler

I have been using Snippet Compiler for a few years, and it's great. Unfortunately, it isn't getting maintained, and is falling behind. Doesn't support .NET 4, which we recently switched to, and even some C# 3 features like extension methods get flagged as errors (though they do compile). Alternatives? ...

What's wrong with this C# CodeSnippet?

I've made snippets before but I must be overlooking something really simple; I cannot figure out where the error is in this snippet... <CodeSnippet Format="1.0.0" xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"&gt; <Header> <Title>Throw NotImplementedException()</Title> <Author>olaffuB</Author> <Shortcut>nie</S...

Visual Studio Snippets: How to reference an assembly that is not in the GAC

Hi, I have a 3rd party non-signed assembly that I want to reference in several projects. So I created a snippet to add the reference and the relative imports I tried the following, and several variations with full paths, without file:// etc, to no avail. Any ideas? ... <Snippet> <References> <Reference> <Assembl...

Hide header if node body is empty - Drupal php snippet help

Hello! I've made a content type for links, I'm trying to make a link directory. People only have to submit the link, description is voluntary. If no description is entered, I want the header that says "description" to disappear. The description field is the node body. Right now my snippet looks like this <?php if (!empty($node->body)) {...

C++ snippet support in visual studio?

I'm writing code in native C++ (not C++/CLR). I know that there is no built-in support for C++ with regards to the snippet manager and snipper picker interfaces, however I found a utility called "snippy" which supposedly can generate C++ snippets. Here is a c++ snippet that the program generated: <?xml version="1.0" encoding="utf-8"?> <...

SQL Server 2008 Sql snippets

I think that this is a relatively simple question. I just want to know if you are able to save or use SQL snippets like you can in Visual Studio, but within SQL Server Management Studio? I've had a browse but couldn't find anything. ...

Using code snippets in Visual Studio

Right now when I want to use the cw snippet, I'm typing cw, tab, tab. Is this the correct(fastest!) way of doing it? If there'd be some way of only having to hit once the tab key or any other key i'd be glad to know it. ...

Using VS Code Snippets with Resharper

I am trying to use Code Contract's Code Snippets but since I turned Resharper back on it doesn't recognize them. On the other hand, it is recognizing some snippets I've implemented myself in the past. Any ideia of what might be the problem? I'm specifically trying to use cr and ce, which I think, don't collide with any other snippets (a...

Notepad++ replacement

I've been using Notepad++ for a while now, but I noticed it doesn't have code snippets (I found the QuickText plug-in, but it doesn't work anymore), so I'd like to switch editor and my requirements would be: Fast startup. Code snippets. Ability to use themes. File tree view (or plug-in, which does that). FREE if possible, but I...

IntelliSense has forgotten my code snippets!

Hi all I have a stack of code snippets imported into Visual Studio. Just recently, they have stopped displaying in Intellisense. If the keyboard shortcut doesn't bring up anything else on IntelliSense, then I can tab and the code snippet is inserted just fine. However, if the keyboard shortcut for the snippet happens to also bring up ...

Can I create template-based library objects in Dreamweaver CS5?

At work we need two 'streams' of template. The first are general layout templates, like the ones already available in the MX through CS5 packages (except we'd have our own customised ones). The second are more granular objects, some of which are functional. In both cases, I don't want Jimmy to be able to wreak havoc inside anything othe...

VS2010 - shortcuts for web controls and HTML snippets

Consider the feature in Visual Studio 2010 for snippets in the HTML Source view of a web page. type a control name in plaintext with no markup or brackets! ... e.g. hyperlink. Then hit Tab Your web control has been auto-completed for you. It's up to you to fill in the other details that you need. This works for form as well: ...

Versioned cloud-based social code snippet management

It seems a lot to ask, but I'm looking for a cloud-based solution to managing code snippets. I am looking for: Tags User accounts (I want to be able to see all of my snippets on a single page) syntax highlighting versioning - myself or others should be able to edit my snippets to improve them and have revisions save so that I can go b...

textmate snippets and tabs

hello, i'm using snippets in textmate a lot -- especially for adding API documentation to my sources. you can define placeholders in a snippet and you can use TAB / SHIFT+TAB to jump between those placeholders. my question is: is it still somehow possible to insert a tab at the current cursor position inside a placeholder position ...

Create mysql backup from server, download locally with scp and replace mamp database

I'm creating a snippet to be used in my Mac OS X terminal (bash) which will allow me to do the following in one step: Log in to my server via ssh Create a mysqldump backup of my Wordpress database Download the backup file to my local harddrive Replace my local Mamp Pro mysql database The idea is to create a local version of my curren...

Getting Textmate to create PHP autoload class name from filepath

What I would like is a snippet that when executed, grabs the TM_FILEPATH output Explodes it on the slash / Then split out each part as a placeholder containing that part and an underscore (apart from the last part (the filename)) For Example: for a file in directory path /Path/To/Original/file we would get class ${1:Path_}${2:To_}${3:Or...

Which PHP Session class should I use?

Hey everyone, I'm looking to do basic stuff with sessions (user logins, authenticated forms & pages) and am just wondering what's the best wrapper/helper class out there to do this. If you have one that you've written or really like that you'd like to share with some snippets, I'd greatly appreciate it. Cheers, ...

Snippets Question - Escaping the $ character

I find myself doing a ton of jquery these days so I started to abstract out some of the common things I do into snippets. I look forward to sharing these with the community, but i'm running into an issue right now. The literals in snippets are defined by adding dollar signs ($) around the name of the literal to delimite where the value...