code-snippets

Code snippets for methods in Visual Studio

血红的双手。 提交于 2019-11-29 19:57:24
In Visual Studio I can type e.g. for TAB TAB and a code snippet pops in. Are there built-in code snippets for private, public, etc. methods as well? Cameron MacFarland ctor : Default constructor prop : Property propg : Read-only property sim : static int main method svm : static void main method There's a good list here . And if you want to make your own, the Snippet Designer is very good. Here are all the Visual C# code snippets for Visual Studio 2017 Scott Nimrod You can download the method snippets as a Visual Studio Extension . It supports the following: method (typical method) vmethod

Why sysout won't work?

被刻印的时光 ゝ 提交于 2019-11-29 19:14:06
问题 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 + space . It is a shortcut for input method on my computer. I don't know if this is related to my unable to use the sysout. If not, please let me know how I can get my sysout working. If yes, please kindly let me know how I can reset 'ctrl + space'

How do you manage your gists on GitHub? [closed]

廉价感情. 提交于 2019-11-29 18:33:38
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 difficult to find some of my old gists. There's no search, no tagging, or anything. Do you know any application that can handle this mess? I would like an application that could Search my gists List my gists by source type and date Let me edit or copy them Let

Fast Median Filter in C / C++ for `UINT16` 2D Array

故事扮演 提交于 2019-11-29 14:49:01
问题 Does anyone know a fast median filter algorithm for 16-bit (unsigned short) arrays in c++? http://nomis80.org/ctmf.html This one seems quite promising, but it only seems to work with byte arrays. Does anyone know either how to modify it to work with shorts or an alternative algorithm? 回答1: The technique in the paper relies on creating a histogram with 256 bins for an 8 bit pixel channel. Converting to 16 bits per channel would require a histogram with 65536 bins, and a histogram is required

Add time and date in custom/user Code Snippet in XCode

倖福魔咒の 提交于 2019-11-29 10:34:09
How can I add date time in my custom code snippet? I need frequent use to add my codes on other codes, and for others, I need to add my name and date time. I created a code snippet with shortcut _ase, but I am not finding any help on net how can I add time to it. You can't add date or time automatically using the native Xcode snippet grammar. Snippets do not have anything other than token substitution using the <#VisibleTokenName#> syntax. File templates are generated differently and have token substitution for a small subset of predefined tokens (like ___DATE___ ) in addition to the ability

What code snippet editor do you use? [closed]

微笑、不失礼 提交于 2019-11-29 06:44:41
Part of my "sort your development life out, Rob" push has been me taking note of the fact that I do not have a library of code snippets (and Jeff did a post too ). Now I have a few, but I know I should really be working towards creating my own library to boost my productivity. One thing I have started doing is leaving my code snippet editor open ( Snippy ) and whenever I realise I am writing common code, I stop and make a snippet for it. I was just wondering what editors you guys use? There may be a better one out there, and if I am missing out I so want to get in on that! :) Aaron Sanders I

How to generate the snippet like those generated by Google with PHP and MySQL?

℡╲_俬逩灬. 提交于 2019-11-29 04:42:09
For example, it just returns the snippet around which the searching keyword exists. And part of the text is replaced by "...". Is it possible to achieve that goal with PHP and MySQL? Modified deceze's function slightly to allow multiple phrases. e.g. your phrase can be "testa testb" and if it does not find testa, then it will go to testb. function excerpt($text, $phrase, $radius = 100, $ending = "...") { $phraseLen = strlen($phrase); if ($radius < $phraseLen) { $radius = $phraseLen; } $phrases = explode (' ',$phrase); foreach ($phrases as $phrase) { $pos = strpos(strtolower($text), strtolower(

Insert current datetime in Visual Studio Snippet

馋奶兔 提交于 2019-11-29 03:54:10
Does anyone know of a way that I can insert the current date & time in a visual studio 2008 snippet? What I want is something like this in the body of my .snippet file... <Code Language="csharp"> <![CDATA[ // $DateTime$ // more code here for my snippet... </Code> There are no DateTime functions available for snippets but here is a macro that will insert the current DateTime: Sub PrintDateTime() If (Not IsNothing(DTE.ActiveDocument)) Then Dim selection As TextSelection = DTE.ActiveDocument.Selection selection.Insert(DateTime.Now.ToString()) End If End Sub You can open your macro explorer with

Escaping the $ character in snippets

余生颓废 提交于 2019-11-29 02:47:28
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 delimit where the value you would like to provide will go. This is difficult because jQuery uses the dollar sign notation in order to use a lot of its functionality. What is the escape sequence for snippets, so I am able to use the dollar sign, and have my snippets still function? To

How to determine whether a string is valid JSON?

孤街醉人 提交于 2019-11-28 22:22:35
Does anyone know of a robust (and bullet proof) is_JSON function snippet for PHP? I (obviously) have a situation where I need to know if a string is JSON or not. Hmm, perhaps run it through a JSONLint request/response, but that seems a bit overkill. Daff If you are using the built in json_decode PHP function, json_last_error returns the last error (e.g. JSON_ERROR_SYNTAX when your string wasn't JSON). Usually json_decode returns null anyway. What about using json_decode , which should return null if the given string was not valid JSON-encoded data ? See example 3 on the manual page : // the