code-snippets

Snippets for productivity - collect good code

Hi folks! I was wondering whether there're recommendable sites, that host collections of good and useful code-snippets. Searching stackoverflow, to be honest, sometimes is priceless. - But if you know sites like commandlinefu (just for Shell stuff), you may also want something like that for Ruby, Java, Python or C#. There're some sma...

How can I add the "--watch" flag to this TextMate snippet?

I love TextMate as my editor for all things web, and so I'd like to use a snippet to use it with style.less files to automatically take advantage of the .less way of compiling .css files on the fly using the native $ lessc {filepath} --watch as suggested in the less documentation (link) My (thanks to someone who wrote the LESS TM Bun...

Replace text in a Visual Studio Code Snippet Literal

Is it possible to replace text in a Visual Studio Snippet literal after the enter key is pressed and the snippet exits its edit mode? For example, given a snippet like this: public void $name$ { $end$ } If I were to enter $name$ as: My function name is it possible to have Visual Studio change it to: My_function_name or ...

Get filename without extension, textmade bundle editor

Thought this might work: ${TM_FILENAME/(.+?)(\.[^.]*$|$)/} But it's giving me this error: Error Parsing Snippet line 1:257: expecting regexp options, found '' Any tips? ...

can anyone explain this javascript textmate snippet to me please

hi all, the following code is a textmate javascript snippet, can anyone explain it please? cuz i want to use this feature in my own snippets. greate thanks. document.getElement${1/(T)|.*/(?1:s)/}By${1:T}${1/(T)|(I)|.*/(?1:agName)(?2:d)/}("$2") ...

Who invented zen coding and is there a published specification somewhere ?

Background: "Zen coding" is apparently the name of a style of text-entry in an IDE or editor whereby the user can type small abbreviations that are expanded into HTML. This is not necessarily a new idea, just an elaboration on an old one that many editors support. The nice thing about it is that the manual entry takes on an aspect of ...

Instantiate stdClass in place

Is it it possible to do this in php? Javascript code: var a = {name: "john", age: 13}; //a.name = "john"; a.age = 13 Instantiate the stdClass variable on the fly ? ...

With VIM, use both snipMate and pydiction together (share the <tab> key?)

I am trying to use snipMate and pydiction in vim together - however, both use the <tab> key to perform their genius-auto-completion-snippet-rendering-goodness-that-I-so-desire. When pydiction is installed, snipMate stops working. I assume its because they can't both own the <tab> key. How can I get them to work together? I wouldn't m...

What code snippet plugins are available for VS2008?

I want a code snippet editor for VS2008. I'd like to just hit a hot key, bring up an editor, type in my snippet, run to my break point and step through. I don't want to have to create a project, create an xml file, or even have to save my file if I don't want to. I've looked through What plugin would you really like to have for Visu...

Eclipse: code completion based on snippets

I would like to accomplish two tasks at once. First, to move my snippets of code from .txt files and be able to tag them/organize better. Second, assign shortcuts to those snippets that will allow me to type "p" + TAB which will render assigned snippet (I don't care of cursor position etc) ...

Code snippet paths in GCC

Background: Keil C51 on a PC, currently moving to GCC (CrossPack-AVR) on an iMac. Since I write firmware for micro's I have a lot of 'driver' source files etc. that I need to include with my programs, e.g. a LCD driver, i.e. reusing code. These code snippets (.c and .h files) live sub folders in a /snippets/ folder, i.e. /snippets...

How do you put html or xml into a yaml?

I would like to store html snippets inside a yaml file, what is the best way to do that? something like: myhtml: | <div> <a href="#">whatever</a> </div> ...

Are the VB.NET code snippets available for C#?

Question I was wondering if anyone knows where I might find C# versions of the VB.NET code snippets built in to Visual Studio (2008)? What are Code Snippets? VB.NET has a wide-ranging collection of snippets that cover most of the basic tasks one might want to accomplish, i.e. File I/O, LINQ, DB connectivity, and so on. C# has a much s...

Best blogging software for developer

What's the best blogging software for a developer? In addition to the normal blogging stuff I want: Code snippets with highlighting in many languages, though primarily python and C++ Good markup syntax Runs on linux Ability to put images, such as diagrams, inline If Wordpress is the answer, what plugins should I get? In the past I've...

Vim + Snippets isn't working

Hi guys, I'm not sure if this question should be done in the superusers, but anyway, lets give it a try. Here is my problem.. I'm running ubuntu 9.10 and I'm tying to create a development environment with Vim and it's plugins. I've done everything that I needed, but I'm having some issues with the snippets: When I'm in a model and I p...

Code snippet manager suggestions

I'm looking for a code snippet manager per the following: Usable on Windows stand-alone product desktop-based (not online) Free or paid Has PHP syntax highlighting I've found the following, but they don't seem to quite ring the bell (although they are good products): -- Snip-It Pro (not free) -- Has syntax highlighting, but seems "n...

C# snippet to create snippets

Anyone have a snippet (or know where one exists) to create snippets? I saw one in a video demo for Visual Studio snippets a few weeks ago, but I can't remember where it was. ...

PHP How to include files based on creation date?

I want to create a news page that includes a snippet of the latest 3 filea created in the following directory structure: So lets say I have the following files: /news.php /2010/the-latest-article.php /2009/some-long-article-name.php /2009/another-long-article-name.php /2009/too-old-article-name.php /2009/another-old-article-name.php I...

How to use C++ code snippets in Visual Studio 2008 Pro?

I have prepared C++ code snippet. How to use it in VS2008 Pro? ...

Events subscribing equivalent of "+= Tab Tab" in C# VS IDE

Hello. I wonder what is (if is) the "shortcut"(code-snippet) for adding handlers in VB.NET (Visual Studio 2005/08), equivalent to the += + Tab + Tab in button1.Click += ... C# IDE. In this way C# IDE auto-creates the necessary method, with all necessary parameters. So, If I know that I need to execute a method at a event even if I don...