Menu
  • HOME
  • TAGS

Why wont my loop work?

javascript,code-snippets

You can use a interval based solution instead of using a while loop like console.log('START LOOP MY FUNCTION'); //start the function loop(function () { //this callback will be called once `a` becomes 1 console.log('EXIT LOOP MY FUNCTION'); }) function loop(callback) { var a = 1, timer; //to run myFunction every...

lift error, method not found

scala,lift,code-snippets

This occurs because the HTML5 parser Lift uses converts all tag and attribute names to lowercase. It is recommended to use either: class="lift:Snippet" or data-lift="Snippet" to avoid that. This was not an issue with the older XHTML parser as that was case sensitive, so you will find some older documentation...

ClassName() did not return any, snippet tool visual studio 2013

c#,.net,visual-studio,visual-studio-2013,code-snippets

I see your problem now. If you add your snippet inside of the class this will work. If you insert this outside of your class on the top this can't work because the class is not the context of the snippet.

Why JS design pattern snippet not work in sublime

sublimetext2,code-snippets

<snippet> <content><![CDATA[ (function (\$) { var defaults = {}; function ${1:name}(${2:element}, ${3:options}) { this.config = \$.extend({}, ${2:defaults}, ${3:options}); this.element = element; this.init(); } ${1:NAME}.prototype.init = function () { }; \$.fn.${1:name} = function (options) { new ${1:NAME}(this.first(), options); return this.first(); }; }(jQuery)); ]]></content> <tabTrigger>jqp</tabTrigger> <scope>source.js</scope> </snippet> This should do the trick....

Keep the code in <# #> bracers

ios,xcode,code-snippets

when block is highlighted just press Return key

add_magic_quotes() is not working in wordpress

php,wordpress,wordpress-plugin,code-snippets,magic-quotes

You don't need to use add_magic_quotes. From the wp_insert_post documentation: This function inserts posts (and pages) in the database. It sanitizes variables, does some checks, fills in missing variables like date/time, etc Emphasis is mine. https://codex.wordpress.org/Function_Reference/wp_insert_post add_magic_quotes essentially iterates over an array and calls add_slashes on each element. This is...

How to use a Chunk and a Snippet in a Resource, but returning only the Chunk when page is loaded using MODx Revolution?

code-snippets,modx-revolution,chunks

if (isset($_POST["value"])) { // here first time checking $var = (int) $_POST["value"]; // (int) is for security purpose // all other your code here ... } ...

Android code snippets for general UI methods and classes [closed]

android,reference,code-snippets,guide

Here are some PDFs you may be interested in: http://www.cs.virginia.edu/~cs201/labs/Vogella-Android-Development-Tutorial.pdf http://pl.cs.jhu.edu/oose/resources/android/Android-Tutorial.pdf http://www.cse.nd.edu/~cpoellab/teaching/cse40816/android_tutorial.pdf http://www.stanford.edu/class/ee368/Android/Tutorial-1-Basic-Android-Setup-Linux.pdf Further I recommend watching videos instead. Check out over here in these you could find many series teaching you what you want I believe that thenewboston and leveluptuts are good choices...

installing ultisnip with vim-snippets

vim,code-snippets,ultisnips

c-j is a very common mapping and could be used by other plugin / or tmux, Try to change the mapping to c-e

Adding CodeSnippet Plugin to CKEditor in Rails App

javascript,ruby-on-rails,ckeditor,code-snippets

I wasn't able to get this to work at all using any ckeditor gems. As a result, I completely removed the ck_editor rails gem and downloaded a build directly from the ckeditor website with the plugins I wanted added in. I then placed the whole ckeditors folder into my app...

How do I expand a snippet, while inside of another snippet?

sublimetext,code-snippets,sublimetext3

You can specify the position of the cursor using $0, example: <snippet> <content><![CDATA[ <ul>$0</ul> ]]></content> <tabTrigger>ul</tabTrigger> <scope>text.html</scope> </snippet> I recommend taking a look at the excellent Emmet plugin, as it makes scaffolding of nested HTML tags pretty easy....

Snippet usefulness - Function.prototype.call.bind(Function.prototype.bind)

javascript,code-snippets

Judging by the blog post, there is no 'usefulness' except syntactic sugar, turning: slice.call([1,2,3], 0, 1); slice.apply([1,2,3], [0,1]); to slice([1,2,3], 0, 1); The change allows to pass proper this context as the first argument of the function without explicitly calling call and apply....

Sublime snippet to get a Title case field mirrored as a lowercase

regex,sublimetext2,code-snippets

Instead of doing a simple replacement, you need a format string to your regex, as discussed in the snippets reference. So, your snippet should look like this: <snippet> <content><![CDATA[ get${1:User} ('$2', function(err, ${1/(.*)/\L\1\E/i}){$0}); ]]></content> <!-- Optional: Set a tabTrigger to define how to trigger the snippet --> <tabTrigger>get</tabTrigger> <!-- Optional:...

Remove Built-In Code Snippet from Visual Studio 2012

visual-studio-2012,code-snippets

When you select a snippet in Code Snippets Manager, the Location is listed in the text box above the list. You can select that location, and paste it into an Explorer Address bar and open the file location of the snippet. Just delete the offending snippet and you'll never see...

Automatic checking of GTM Tags

google-analytics,code-snippets,google-tag-manager

There are a few paid services that I can think of: Observepoint Tag Inspector I'm sure there are others, but those are the ones I've used. You can also use GTM's error tracking to log client-side JS error. Doesn't really check to see what tags are firing, but will let...

Sublime text snippet error - 'No content for snippet'

sublimetext2,sublimetext3,sublimetext,code-snippets

The $ character is a special character used in snippets to add fields or variables. So, you need to escape all your $ characters in your snippet with the \ key. You can read it in Sublime Text docs: If you want to get a literal $, you have to...

Visual Studio + Razor: “Surround with…” Snippets

c#,asp.net-mvc,razor,code-snippets

I think it's just an oversight on Microsoft's part. I found the snippets path by choosing Tools -> Code Snippets Manager, selected HTML as language and selected ifcs4. The path for the snippet is (for VS 2013): C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 4\Visual Studio 2013\Snippets\HTML\1033\ASP.NET MVC 4\ifcs.snippet I updated the...

How To Make A Simple Dice System

c#,probability,code-snippets

Creating a "Dicebag" is quite simple; it takes little to no effort at all to write it. However, there are a few things that need to be described before continuing. A die(plural "dice") can never be zero or negative, thus when writing the class we need to prepare for that...

sublime snippet for jquery ajax not rendering

jquery,ajax,sublimetext,code-snippets,sublimetext3

You have to escape the dollar sign: \$

Distribute SQL_SSDT Code Snippets using vscontent (lang attribute error)

visual-studio-2012,code-snippets,ssdt

It seems that VS Content Installer has no support for deploying SSDT code snippets. There is a posted idea on visualstudio.uservoice.com which requests this feature, but it is still open. I did not found any other resources related to this issue. There is a possible workaround, which needs testing: You...

Sublime 3 JS Snippets to Typescript

javascript,typescript,sublimetext3,code-snippets

You have to add a typescript source to your snippets scope. <scope>source.js, source.ts</scope> There is a exemple of snippet that you can find in the TypeScript package: <snippet> <content><![CDATA[ class ${2:ClassName}${3: extends ${4:AnotherClass}} { $5 ${6:constructor}(${7:argument}) { ${0:// code...} } } ]]></content> <tabTrigger>class</tabTrigger> <scope>source.ts</scope> <description>class …</description> </snippet> ...

Can somebody help explain what is happening in this fft code snippet

c,fft,code-snippets

now the problem I am having understanding is what is happening when the int is added to the cplx Actually the addition is not <int> + <cplx> but <int> + <cplx>* (in words an integer plus a pointer to a complex). So what you're dealing with here is what's...

What's wrong with this C code for finding HCF?

c,code-snippets

What you´re printing as HCF (GCD) is always 0, because it´s dr and the loop runs until dr is 0. The "problem" is that you´re printing dd after dr without any space etc.between them, so it appears as one number. If you remove the second printf, only the 0 of...

Modx - Getting the current context

code-snippets,modx-revolution,modx-getresources

What you have is exactly right, probably something to do with getResources. ~ try calling it uncached. if not, try setting your context key as a context setting so you can call it as [[++context_key]] or in your context snippet set it as a placeholder: [[!context]] [[!getResources? &parents=`0` ... &sortby=`menuindex`...

How can I easily create a case (switch case) for all enum items?

c#,resharper,code-snippets

Set the cursor after the first brace within the switch statement and press Alt + Enter. You will see the option to generate switch labels.

Subline text color in webpage code snippet

sublimetext2,code-snippets

You can write your snippet in ST2 and then export it to HTML using ExportHtml. This plugin allows the exporting of a document in ST2 to an HTML file or to BBCode. It duplicates ST2's theme colors and font styles. ...

How can I find (and rehabilitate, if necessary) the Code Snippet I created?

visual-studio-2010,visual-studio,code-snippets,vsinstaller

Here's an easier way (and, as a bonus, it works): Download the Snippets Designer: Write the code directly in Visual Studio: var RowName = new HtmlTableRow(); var Cell1Name = new HtmlTableCell(); var Cell2Name = new HtmlTableCell(); RowName.Cells.Add(Cell1Name); RowName.Cells.Add(Cell2Name); Right-click and select "Export as Snippet" This puts the code in the...

how to use the $ char in sublimetext snippets?

javascript,jquery,sublimetext3,code-snippets

You can escape special characters like $ with the backslash key \. Example: \$(document).ready(function(){ ${1} }); Result: $(document).ready(function(){ ${1} }); ...

How to implement this - generate setter automatically?

ios,xcode,code-snippets

It's code snippet. You can create your own code snippet in XCode. Type the template code in XCode Copy it and drag it to the comment section in the Utility panel Give a title and completion shortcut Whenever you type the shortcut, XCode will show the auto-completion option ...

Usings and assembly references are not automatically imported from C# snippet

c#,.net,visual-studio,namespaces,code-snippets

Is not supported. You should read more carefully the page you linked: If you create a Visual Basic code snippet, you have the ability to specify the necessary references and Imports statements required for your code to run. Why do you expect this should work in C#?...

Mising code snipper testc after R# install

.net,visual-studio,testing,resharper,code-snippets

ReSharper doesn't show Visual Studio snippets in code completion, but they're still there. Type testc and hit tab. It should expand the snippet.

Condense all my snippets into one file in Sublime Text 3

sublimetext2,sublimetext,sublimetext3,code-snippets

You can use a .sublime-completions file. These are JSON-formatted files that contain the target scope at the top, then a series of completions with a trigger and contents. For example, the following snippet <snippet> <content><![CDATA[function ${1:function_name} (${2:argument}) { ${0:// body...} }]]></content> <tabTrigger>fun</tabTrigger> <scope>source.js</scope> <description>Function</description> </snippet> can be turned into this...