code-snippets

Short Python Code to say "Pick the lower value"?

What I mean is, I'm looking for really short code that returns the lower value. for example: a=[1,2,3,4,5,6,7,8,9,10] b=[1,2,3,4,5,6,7,8] len(a) = 10 len(b) = 8 if (fill-this-in): print(lesser-value) And I forgot to add that if b is lower than a, I want b returned - not len(b) - the variable b. ...

Code snippets for Delphi?

Is there a good code snippets application for Delphi or general purpose with IDE integration? I would like to store Code, queries, notes, etc.. Thanks ...

Creating Snippets of ViewPage ServerSide Code

Hi again, I am working on an ASP.NET MVC Project and I have a number of node snippets that I need to insert into multiple pages. I would very much like to know whether or not it is possible to have a snippet of code that can be placed in an external file and called from within a ViewPage. In a way this would be similar to calling a class...

What is your most useful C/C++ utility?

It seems that every project has an "utility" module with various code snippets used throughout other files and which don't fit any particular pattern. What utility classes, functions, and macros do you find most useful in your C/C++ projects? Please keep the entries small (under 100 lines) and give only one example per post. ...

Is it possible to insert a multi-line code snippet relative to the cursor position in Visual Studio?

When using code snippets in Visual Studio that contain multiple lines the following lines will preserve the whitespace that was set in the .snippet file instead of positioning the code relative to the original cursor placement. When using the foreach snippet you'll get code like this: foreach (var item in collection) { } Instead...

What is the code snippet you are most proud of?

I am sure that at some point we all come up with a way of doing something that make us proud. It may not be something "worthy of production" because of performance or whatever, but you still like the concept. So, SOers, what is that snippet you are most proud of? [EDIT] I had forgotten to mark it as community wiki...fixed that ...

Anyone have any cool code snippets

Code snippets are a pretty underused feature in Visaul Studio and it can really save you alot of time. What custom code snippets do you guys use in your everyday coding? Let me list some of mine: vprop - view state property ane - argument null exception event - definition for an event handler noe - expands into String.IsNullOrEmpty(...

What legal issues can I run into if I use example code (say from stackoverflow) in my projects?

A couple of questions I've read today discuss the legal implications of using someones code in your project: Can I legally incorporate GPL & LGPL, open-sourced software in a proprietary, closed-source project? Do you save the code you wrote at your previous jobs? This has left me wondering where example code found online fits into t...

Using Eclipse Templates for Actionscript

One of my favorite features in Eclipse is the templates in PDT. In case you don't know what they are, think of writing "function" and having Eclipse write all the syntactical features and let you jump from variable to variable with a tap of the tab key. So I'm starting to do write AS3 in Eclipse and I miss having the templates at my fing...

MSSQLServer 2008 Management Studio Snippets

Is there a snippets feature in MSSQLServer 2008 Management Studio? ...

What websites do you use to post temporary code snippets?

Following on the heels of What is your preferred site for code snippets, I'm looking for a website to post a short blurb of formatted code. I don't want to create a login. I'm looking for a simple: paste, use and forget. I know it exists, I've used it before, but my google skills are failing me! ...

Short (and useful) python snippets

In spirit of the existing "what's your most useful C/C++ snippet" - thread: Do you guys have short, monofunctional Python snippets that you use (often) and would like to share with the StackOverlow Community? Please keep the entries small (under 25 lines maybe?) and give only one example per post. I'll start of with a short snippet i ...

How do I auto-create a code snippet in Visual Studio 2008?

I'm trying to create an interface that automatically implements a fully typed out method in VB.Net However, I can't figure out how to do it. I wanna do something that's similar to what happens when you implement IDisposable, where it gives you the full function, including codes and comments. I know how to make a code snippet and how ...

Editor with textmate snippets support ?

Hi guys, I know of etexteditor and vim/emacs. Are there any other windows editors which have textmate-like snippets support (eg. you write trigger word, press tab, it changes to something, you press tab again, and it changes to first stop, you can then enter something there and it will change on several other places according to snippe...

how to write if null surround-with code snippet

I'm trying to write a vs code snippet that will take the selected and surround it with an if null check, i.e. accgrp.CREATEDATE = DateTime.Now; will become: if (accgrp.CREATEDATE == null) { accgrp.CREATEDATE = DateTime.Now; } I've got as far as the below. $selected$ only seems to work the last time it is...

How can I keep from retyping the same line of code over and over?

I want to understand if code snippets are what I am looking for here. I wind up writing the same line of code over and over during a refactoring. Is there anyway I can create a shortcut that will spit out a line of code that I need? ...

wpf snippets

Not the visual studio integrated kind, the snipplr, dzone snippets, etc. kind. I went to a few of these sites and didn't see anything for WPF. I was thinking of posting a few I like somewhere, and was hoping to find a site that already had some. Recommendations? So far I'm liking the dzone functionality. ...

Looking for a tool that will let me store and insert text fragments (code snippets) into Visual Studio

I have a demo coming up and would rather not type in front of the audience. I figured I could put the code snippets some place and put them in as I go. Now I know I can use Notepad (or pretty much any other text editor) for the purpose but I have a feeling there's something nicer out there. Anybody have any ideas for me? Ideally I'm lo...

How can you automaticly insert a namespace for a Visual Studios snippet?

I have a code snippet that creates a C# class for me. It puts the regions in all the right places and sets it up just the way I like it. When I create a class by adding a new item it automatically creates the namespace based on my project and folder structure. Is there a way I could do the same action with my custom snippet? Is there...

code snippet for vc++[code snippet manager]?

Where can I get a code snippets for VC++ that can be used with the code snippet manager in Visual Studio 2008? I have SnippetEditor installed how to create snippet for VC++. ...