code-snippets

VS13/VS15 - can't import SQL snippet

旧时模样 提交于 2019-12-11 13:57:57
问题 I would like to create sql snippet in VS2013 and VS2015. I don't know why, but I've got an error while importing (in both of VS): "C:\sql.snippet: Missing or unspecified Language attribute" My snippet: <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2008/CodeSnippet"> <CodeSnippet Format="1.0.0"> <Header> <Title> My Snippet </Title> </Header> <Snippet> <Code Language="SQL"> <![CDATA[select * from MyTable]]> </Code> </Snippet> </CodeSnippet> What's wrong? The language "SQL"

Visual studio code: replace char case while typing in snippet

让人想犯罪 __ 提交于 2019-12-11 12:32:48
问题 I'm trying to write code-snippet for Visual Studio Code and TypeScript. So far I managed to mirror typed word like this: import { ${1:Name}Component } from './${1:name}.component'; When I type the word in place #1 it is mirrored to place #2 like this: import { MynameComponent } from './Myname.component'; Is it possible to change snippet so the place #2 is in lower case like this: import { MynameComponent } from './myname.component'; 回答1: The ability to transform snippets has been more

Stuck with paginating youtube api playlist results, trying to calculate tha sum duration of all the videos in a playlist

纵饮孤独 提交于 2019-12-11 11:43:22
问题 I would like to make a little php snippet for my drupal site, which counts all the durations of all the videos in a youtube playlist. I managed to find a good starting point here at this site, I made some changes, and it is almost good: <?php $playlist_id = "266DBEDBE6892C11"; $url = "https://gdata.youtube.com/feeds/api/playlists/".$playlist_id."?v=2&alt=json&start-index=1&max-results=50"; $data = json_decode(file_get_contents($url),true); $info = $data["feed"]; $video = $info["entry"];

Get today's date from Sublime 2

孤街浪徒 提交于 2019-12-11 11:39:34
问题 I'm a Sublime Text newbie, I was using Textmate before and there I had a handy 'today' command that was returning today's date in the editor (using the shell). eg 'today' + TAB ==> '12/10/2012/' How would I create something like that in Sublime? 回答1: Sublime Text 2 has a feature called Snippets, this allows for only static 'expression' + TAB replacements. It seems someone is working on a plugin called SMART Snippets in which you can use python code in the Snippets. With SMART Snippets, You

Vim-snipMate doesn't expand insted removes the trigger

社会主义新天地 提交于 2019-12-11 10:56:49
问题 I was using snimpmate with vim-snippets plugin, and all fine. Until i tried to remove the vim-snippets and use my custom and only snippets 'ruby.snippets' on '.vim/snippets'. i think the snippets are being loaded just when fire TAB or whatever trigger it just removes the text... and leave blank space. def hello if |TAB| end results in def hello end is the same problem here 回答1: You provide very little information to help you with troubleshooting. Here's one function (from my

How to edit the default 'New Snippet' template in Sublime Text 2?

喜欢而已 提交于 2019-12-11 10:50:48
问题 I create a lot of snippets for Sublime Text 2. I always use the optional tab trigger and never use the trigger scope. I'd like to edit the 'New Snippet' template so I don't have to uncomment and delete these respective options every time. TL;DR - Where does this default 'New Snippet' text come from so I can change it: <snippet> <content><![CDATA[ Hello, ${1:this} is a ${2:snippet}. ]]></content> <!-- Optional: Set a tabTrigger to define how to trigger the snippet --> <!-- <tabTrigger>hello<

Displaying custom text in a map snippet, Android

余生长醉 提交于 2019-12-11 04:53:29
问题 Ok, I've been at this all day now, I give up trying to get this myself! I've declared the map and location private GoogleMap googleMap; declared the location static final LatLng SECC = new LatLng(55.8607,-4.2871); generated the map googleMap=((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap(); built the marker Marker secc =googleMap.addMarker(new MarkerOptions().position(SECC) .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_MAGENTA)) .title("SECC")

Faster Django Admin Paginator: Cannot get this Django snippet to work

折月煮酒 提交于 2019-12-11 04:23:42
问题 I found this snippet for improving the performance of large database table queries in Django admin lists: https://djangosnippets.org/snippets/2593/ There are some issues about it when using it with Django 1.10, which are already discussed in my previous question here: How to speed up Django's admin pages with PostgreSQL count estimates? Particularly, _count needs to renamed to count and query_set to queryset . Here's a short version of the relevant part of the snippet: from django.core

Editing Refactoring snippet for C# in Visual Studio 2015, doesn't change the refactoring behaviour?

半腔热情 提交于 2019-12-10 17:13:07
问题 I want to change the typical property generation from outputting this: set { amountOfDogesValue = value; } to outputting something like this: set { if (value > 0) amountOfDogesValue = value; else throw new System.ArgumentException("Parameter cannot be smaller than 0", "DogesAmount"); } ( but ) with some elements that don't compile, in the if clause and throw line, so I can never ever forget to edit them. I use Visual Studio 2015 and have edited C:\Program Files (x86)\Microsoft Visual Studio

SQL SERVER 2014 Code Snippets missing

时光怂恿深爱的人放手 提交于 2019-12-10 16:51:59
问题 I'm trying to use the Snippets functionality in SQL Server. I'm testing out adding new snippets to SQL Server 2014 following the instruction here. Everything works fine except that after I added the snippet, it doesn't show up in the IntelliSense. Even more, I realized that not all build-in Snippets are showing up. I wonder if anyone else has the same experience, and knows how to resolve this? This is a list of build-in snippets under Function And this is what I see from IntelliSense (3 of