podgorniy / js-snippets-st2

Javascript snippets for sublimetext2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

#Javascript snippets for sublimetext2

A bunch of snippets for lightning-like javascripting

Examples

Globals and word-based

// a
arguments

// de
debugger;

// d
document

// l
location

// q
querySelectorAll('')

// w
window

Functions

// f
function () {} // lots of tabstops, wraps selected text

// sif
;(function () {
	// wraps selected text
}());

// sifs
;(function () {
	'use strict';

	// wraps selected text
}());

Loops

// for
for (i = 0; i < arr.length; i += 1) {
	arr[i]
} // arr and i changable

Timers

// set
setTimeout(function () {}, 50);  // or
setInterval(function () {}, 50); // replace T with I while typing,
								 // and text will dynamically changed

// clr
clearTimeout();
clearInterval();

Logging

// cl
console.log(); // wraps selected text

// cw
console.warn(); // wraps selected text

// ci
console.info(); // wraps selected text

// ct
console.timeStamp('');

Ohers

// '
' + + ' // nice tool for string incuting

// if
if () {} // several tabstops

About

Javascript snippets for sublimetext2