Questions tagged [code-snippets]

For issues relating to the creation, use, and maintenance of code snippets.

A snippet is a small region of re-usable source code, machine code or text. Ordinarily, these are formally-defined operative units to incorporate into larger programming modules. Snippets are often used to clarify the meaning of an otherwise "cluttered" function, or to minimize the use of repeated code that is common to other functions.

Snippets can be created and used in many newer IDEs to insert a nearly functional code. With placeholders it is then possible to tab through the missing parts and fill in the variable names of other missing code parts.

For a fast practical use of a theoretical concept it is often preferred to show it on a snippet as an excerpt of the used code with the variable names foo and bar.

1929 questions
14
votes
7 answers

HTML: How to get credit (authorship) for developing a page/site

Despite the new features in HTML5, the use of rich snipers, microdata and what not...I still can't find a proper way to get credit for developing a page/site. Of course, you have BUT that is for the…
Omar
  • 11,783
  • 21
  • 84
  • 114
13
votes
7 answers

VS2010 Code Snippet Shortcut Not Showing

I've created a code snippet in VS2010. It isn't showing as a shortcut when I start typing. I've called it propnch. It is available when I use Ctrl-K, Ctrk-X but when I just start typing prop... it isn't showing as an option. Have I missed some kind…
big_tommy_7bb
  • 1,257
  • 2
  • 21
  • 37
13
votes
3 answers

When creating a VSCode snippet, how can I transform a variable to title-case (like TitleCase)?

https://code.visualstudio.com/docs/editor/userdefinedsnippets#_placeholdertransform My aim is to automatically set the class name within the context of the snippet being inserted. VSCode does not natively support class or method names, but it does…
13
votes
1 answer

Where does Visual Studio save code blocks that are dragged on the Toolbox

You can drag and drop code blocks from the Codeeditor to the Toolbox of VisualStudio, but where does Visual Studio save those code blocks. Are they globally available (for other projects) or only available in the solution/project they are dragged?
Jehof
  • 34,674
  • 10
  • 123
  • 155
13
votes
7 answers

Vim html.erb snippets?? snipMate Need a vim tip

When I'm in an html.erb file, I get no snipMate snippets. I would like both HTML and Ruby, or just HTML would be fine, How would I do this? Would I need to write a set of snippets? If so, is there a way of pulling in existing snippets without…
Daniel Upton
  • 5,561
  • 8
  • 41
  • 64
13
votes
4 answers

Using TM_SELECTED_TEXT in my custom snippets

With the November 2016 (version 1.8) release of VSCode Snippet Variables are now supported, specifically TM_SELECTED_TEXT. This makes me happy as I have used these heavily in both Sublime Text and TextMate. I can't figure out how to get it to work…
13
votes
6 answers

How do you store your personal snippets database in order to use it everywhere (work, etc)?

I've read the several discussions about storing code snippets but I did't find the info that I'm looking for, so let's define it: At home, I have several side projects, most of them quite small, one large, and numerous little examples that…
Singulus
  • 1,958
  • 2
  • 16
  • 16
13
votes
7 answers

Notepad++ premade snippets

I have seen in videos, that people get html template by typing "html:5" or something like that (btw, they're not using notepad++). Is this possible in notepad++? Thanks.
ManBehindTheCurtain
  • 2,498
  • 4
  • 24
  • 33
13
votes
2 answers

Global scope for user snippet in Atom.io editor

I would like to transform some snippets that I wrote for the Sublime Text 3 editor to the atom.io editor. Since I have a "license" snippet that is valid for any type of file (any file extension) then in the licence.sublime-snippet file I did'n…
13
votes
5 answers

Which file does Snippets of Chrome Dev Tool saved at?

As I know , personal data always be saved at profile path which can be find at chrome://version. I added many snippets in my Chrome Dev Tool, and want to backup them . But I cann't find a file that snippets data saved in under this path. Does anyone…
duXing
  • 1,377
  • 1
  • 10
  • 24
13
votes
4 answers

How to write a comment with Emmet plugin in Sublime?

Im using sublime 2 with Emmet plugin. Is there a way to write a comment with speed coding that would produce me something like that:
Lorem ipsum
I've tried div.container And it's not…
Menci
  • 173
  • 1
  • 1
  • 5
13
votes
16 answers

Why sysout won't work?

I checked the preferences settings in my Eclipse, it's all set to default with sysout option on, but when I typed sysout in eclipse, it won't automatically go into System.out.println(). I've checked several other related topics which mention ctrl +…
Zoe
  • 997
  • 4
  • 10
  • 19
13
votes
10 answers

How do you find Leapyear in VBA?

What is a good implementation of a IsLeapYear function in VBA? Edit: I ran the if-then and the DateSerial implementation with iterations wrapped in a timer, and the DateSerial was quicker on the average by 1-2 ms (5 runs of 300 iterations, with 1…
Lance Roberts
  • 22,383
  • 32
  • 112
  • 130
13
votes
5 answers

Create custom code snippet in Visual Studio 2008

Like the title says, how do you create custom code snippets in Visual Studio 2008?
Bryan Roth
  • 10,479
  • 15
  • 47
  • 56
12
votes
4 answers

How do I setup/use ruby on rails snippets and autocomplete in sublime text 2?

I would appreciate if someone could direct me to a website that shows how to do this.. Can't seem to find anything decent enough via google. This will be the first time I'm doing this kind of thing with a text editor.. It has got to the stage where…