code-snippets

How do you find Leapyear in VBA?

时光总嘲笑我的痴心妄想 提交于 2019-12-22 03:23:06
问题 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 average cell worksheet formula also working). 回答1: Public Function isLeapYear(Yr As Integer) As Boolean ' returns FALSE if not Leap Year, TRUE if Leap Year isLeapYear = (Month(DateSerial(Yr, 2, 29)) = 2) End Function I originally got this function

Missing snippet in visual studio

不羁的心 提交于 2019-12-21 08:51:11
问题 Same installation of Visual studio on two machines, but in 1 i cant find the snippet "propdp" for DependencyProperty ? I only have prop/propg, cant really understand why. Is there an addon i have to install? 回答1: Came across this same issue myself today after a fresh install of VS2008 on Win7 64 All I had to do to fix it was to Go to Tools > Code Snippets Manager Select Visual C# from the drop down menu Click Add Select the NetFx30 directory containing the code snippets, in my case it was...

Missing snippet in visual studio

半腔热情 提交于 2019-12-21 08:51:10
问题 Same installation of Visual studio on two machines, but in 1 i cant find the snippet "propdp" for DependencyProperty ? I only have prop/propg, cant really understand why. Is there an addon i have to install? 回答1: Came across this same issue myself today after a fresh install of VS2008 on Win7 64 All I had to do to fix it was to Go to Tools > Code Snippets Manager Select Visual C# from the drop down menu Click Add Select the NetFx30 directory containing the code snippets, in my case it was...

Writing custom completions in Sublime Text 2

我是研究僧i 提交于 2019-12-21 07:29:09
问题 Sublime Text 2 comes with many built-in completions/templates for common idioms. In C++, these include for loops with fields, etc - if I wrote vec and pressed tab, it would expand to std::vector<field> v; where field is a writeable field. Many of these are written in a style that I do not like or do not provide things that I would like them to, and some that I want to use do not exist. Is there a way to modify these built-in "completions" and write my own? 回答1: I believe you're looking to

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

孤者浪人 提交于 2019-12-20 10:35:03
问题 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 copying them? Is there a way of telling vim to go into html mode when it sees .html erb? 回答1: Snippets are stored in directory called snippets somewhere in your ~/.vim folder. If you look there, there is usually one file per filetype, there is a c

Visual Studio code snippets Cursor

蹲街弑〆低调 提交于 2019-12-20 10:14:57
问题 In Visual Studio 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 Language="csharp" Kind="method body" Delimiter="$"><![CDATA[this.SyncThreadRunInvoke(() => { });]]> </Code> Then after inserting: this.SyncThreadRunInvoke(() => { []<- I

Replace parameter multiple times in Xcode code snippets

倾然丶 夕夏残阳落幕 提交于 2019-12-20 09:14:17
问题 Can I create a custom snippet that takes a parameter that is replaced multiple times inside the code? I tried something like: <#class#> instanceOf<#class#>; but it doesn't replace both class placeholders when I insert the snippet and write over the first parameter. 回答1: This is not possible in Xcode 4.x at the time of writing (Sept. 2011). If you want this feature back in Xcode 4.x, please go to bugreport.apple.com and report a duplicate for this rdar that I just preported: Summary: Xcode 4

Short and useful Objective-C snippets?

[亡魂溺海] 提交于 2019-12-20 08:10:52
问题 Since XCode 4, there is now a Code Snippets section which offers the snippets via auto-complete when typing. I'd be very interested in snippets you all have stored in there. What snippets save you the most time (and why)? Please only post actual snippets (meaning no snarky "don't need no stinkin' snippets", and no "i love snippets that do <XYZ>"), and only snippets that are short and sweet (i.e. no more than ~20 lines at the most...). If a snippet is not obviously useful, also explain why you

Emacs Key Binding Precedence

﹥>﹥吖頭↗ 提交于 2019-12-20 06:42:38
问题 I'm frustrated with the default behavior of autocomplete overriding key bindings used by yasnippets . Is there a way to set a precedence so that tab will try to expand a snippet before trying to autocomplete the word? Quick disclosure: I'm using evil-mode. 回答1: If they're both minor modes, then precedence is determined by the order of elements in minor-mode-map-alist which, unless explicitly manipulated, is simply determined by the order in which the libraries were loaded. Ensure that

Atom editor: snippet for inserting a timestamp

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-20 02:28:28
问题 Below is an Atom snippet I was playing with. What I want to do is insert a timestamp with a developer's name at the end. This is useful when multiple folks are working on the same codebase and you need to comment out some code or add a comment. This way other developers know who did what, and when they did it. I've found it very useful and wanted to create a snippet to do this. However, as you can see from the snippet, it's very ugly...JS is not my forte. Is there a clean way to do this? time