code-snippets

Collecting Stackoverflow Q and A's in a text file

I think my method is lame, but I cannot think of a better way to do this. I use Ultraedit text editor to hold all the stuff I cull out of Stackoverflow for PHP and MySQL in a text file. This is my strict format for each new entry: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ TITLE: THIS IS MY TITLE (ALL IN CAPS, FOLLOWD BY A DOTT...

Does anybody know how to create code snippets in Mozilla Bespin

Anybody know how to create code snippets in Mozilla Bespin. Its strange that there's so little documentation about it. How do snippets works? are they directly loaded from a js file? ...

Python Code Snippets

Is there any online resource or a book that provides common code snippets? I really like the "Python Phrasebook", but it doesn't cover Python 3.1. I'd appreciate your comments and advices. Thanks! ...

Can't make Yasnippets work in Emacs, help!

I can't make Yasnippets work (normal version). When I start Emacs it says: error: Error ~/.emacs.d/plugins/yasnippet-0.6.1c/snippets/ not a directory I added this to my .emacs file: (add-to-list 'load-path "~/.emacs.d/plugins/yasnippet-0.6.1c") (require 'yasnippet) ;; not yasnippet-bundle (yas/initialize) (yas/load-di...

How do you manage your gists on github?

I love github and their gist service and that's why I'm keeping a lot of code snippets and even development notes as a gist on my github account. It also makes it easy to share them with my colleagues. The problem is that it doesn't scale!! the github features for gist are primitive and I have lots of gists there which make it really di...

Visual studio code snippets Cursor

In visual studio (2008) when you insert a snippet and finish inserting literals the cursor jumps to the beginning of the snippet. Now I'd like to tell visual studio where the cursor should go afterwards. I've searched the web and actually hold little hope for this to be possible. To illustrate, suppose I have this snippet: <Code Langu...

How to have multiples matches for a snippet in Vim's snipMate plugin (with a dropdown menu).

snipmates expands div as <div id = " "> . I want snipmate to show a dropdown menu where I can choose between div id ="" and div class="" (after creating the second one). The documentation says: snippet trigger A description of snippet #1 expand this text snippet trigger A description of snippet #2 expand THIS text! but this e...

Why are my <pre> and <code> tags reading the markup instead of producing code snipets??

I'm working on this resource page for Churches who want to assist my organization (CURE International) in the Haiti earthquake relief effort: http://blog.helpcurenow.org/test/mockups/jan2010/jan2010_haiti_church_resources.html The trouble I'm having is that under step 4 you'll see I've created banner ads and I'm trying to produce code s...

web service to store, share, discuss code snippets??

i am looking for a web service, a site indeed, to store, share, discuss code snippets i found/created. preferably with well organized user interface so i can easily retrieve codes i saved, as well as social networking capability like share the codes i created, let others to vote, comment, tag and save it........etc. i google bunch of o...

VS2008: Snippet shown in code snippet manager but doesn't exist in editor

According to the Code Snippet Manager in Visual Studio 2008 there is a code snippet named "wpfre" which expands to a routed event registration. However, when I try to enter it into the text editor, Intellisense won't complete to it and if I type "wpfre" and hit TAB it just completes to "wde" which is not the right thing. I googled for i...

VS 2008 Code Snippet Indentation

In VS 2008, there are XML code snippets that seem to be pretty awesome :) However, it seems that the snippets we created do not indent properly. For example if we have the following code: { ... { ... { InsertSnippet here. We get something like: { ... { ... { FirstLineofSnippet S...

VS 2008 VB snippets for C#

I recently made the switch to a new job and consequently the switch from VB.NET to C#. One thing that I miss is all the snippets that are available in VB.NET. VB.NET comes with ~400 snippets and C# only comes with ~100. Also, I have noticed that the majority of VB.NET snippets are task oriented which is exceptionally helpful when you ...

How to force UpperCase in a VS2008 snippet?

I've settled on the following style of creating properties (with a backing field): private _firstName; public string FirstName { get { return _firstName; } set { _firstName = value; } } Given that the name of the property is similar to the name of the backing field, I've improved the built in prop snippet to the following: <?...

How to Load HTML Snippet returned from Handler call into a string?

Hi all I have an ASP.NET MVC application and I'm trying to load the following html snippet from a Handler in another ASP.NET project, from one of my controllers to display in a View: <br /> <div id="ctl00_divCommentary" class="commentary"> <div id="ctl00_divCommentaryHeader"> <span id="ctl00_lblCommentaryHeaderBold" class="...

Visual Studio: Is it possible to define custom functions for use in one's own Code Snippets?

I want to write a Visual Studio snippet which allows me to quickly create a class of the form: public SomeClass { public SomeType SomeProperty { get; private set; } public SomeClass(SomeType someProperty) { SomeProperty = someProperty; } } I want the parameter on the constructor to have the same name as the property, but lower...

Software To Help Me Reuse Code

I often find myself writing small (5-20 lines) files for things like input validation, reading a URL and so on. In fact, I probably write nearly the same files over and over because I either forget that I've already implemented such functionality in another project or I don't want to have to go searching for that file. I want to know i...

get loaded css between 2 div's as stylesheet.css

I'm trying to get a specific generated css for a area on one of my site's to use this css on the homepage from one of my site's. I used all types of soft and ff add-ons to get the complete css for that specific area ,however they not combine the css as 1. I still have to copy/paste , and have chance i get duplicated loaded css. My hope...

Is there a way to access Visual Studio's CodeSnippet framework to manipulate snippets programmatically?

I'm working on a project that is going to be heavily templated, but the templates I'm creating might also work well in future projects as CodeSnippets for Visual Studio. So, I was wondering, is there a way to access Visual Studio's system of loading, parsing, and displaying the CodeSnippets in any way, shape, or form? For example, it ...

Quality PHP code/snippet repositories?

Does anybody know any larger repositories of high-quality PHP classes and snippets? The only site I know is phpclasses.org, and while I mean no disrespect to its owner/s, its design looks pretty outdated (already has for a looong time) and the "social control" in terms of people reviewing and commenting on code is weak: There are lots an...

Debug Error in Ruby script

I'm very new to Ruby. I have the following piece of code which is giving me an error. class ItemsController < ApplicationController def populate Location.all.each { |l| place = l.radar_place next if !place news_items = place.radars news_items.each { |ni| t = Lbs2.new t.lat = l.lat ...