Skip to content

unlucio/sublimeSnippets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 

Repository files navigation

Sublime Text 2 Snippets

Just another set of snippeds for javascript and node.js

Install

Without Git: Download the latest source from GitHub <https://github.com/unlucio/sublimeSnippets>_ and copy the whole directory into the Packages directory.

With Git: Clone the repository in your Sublime Text 2 Packages directory, located somewhere in user's "Home" directory::

git clone git://github.com/unlucio/sublimeSnippets.git

The "Packages" packages directory is located at:

  • OS X:: ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/User/

  • Linux:: ~/.Sublime\ Text\ 2/Packages/User/

  • Windows:: %APPDATA%/Sublime Text 2/Packages/User/

Usage: Avvailable snippets shortcuts:

General JS

  • forin
for(var indexName in map){
	var object = map[indexName]
	 // body...
}
  • jparse
JSON.parse(string, optinalReviver)
  • jstring
JSON.stringify(object)
  • stt
var self = this;

Node.js

  • node.object.class
module.exports = (function (ObjectName) {
	ObjectName = function(options) {
		//constructor body
	};
	ObjectName.prototype.methodName = function(arguments) {
	  //method body
	};
	return ObjectName;
}());
  • node.assert

  • node.assert.deepEqual

  • node.assert.doesNotThrow

  • node.assert.equal

  • node.assert.fail

  • node.assert.ifError

  • node.assert.notDeepEqual

  • node.assert.notEqual

  • node.assert.notStrictEqual

  • node.assert.ok

  • node.assert.strictEqual

  • node.assert.throws

  • node.event.addListener

  • node.event.emit

  • node.event.EventEmitter

  • node.event.listeners

  • node.event.listenerCount

  • node.event.on

  • node.event.once

  • node.event.removeAllListeners

  • node.event.removeListener

  • node.event.setMaxListeners

  • node.util

  • node.util.debug

  • node.util.puts

  • node.util.format

  • node.util.inherits

  • node.util.inspect

  • node.util.isArray

  • node.util.isError

  • node.util.isRegExp

  • node.util.log

  • node.util.print

  • node.util.debug

Express.js

  • express.callback
function (req, res, next) {
	res.send("responseText");
});
  • express.errorCallback
function (err, req, res, next) {
	res.status(err.status || 404).end(err.message);
}
  • express.res.status
status(statusCode)
  • express.res.set
set(field, [value])
  • express.res.head
header(field, [value])
  • express.res.get
get(field)
  • express.res.cookie
cookie(name, value, [options])
  • express.res.clearCookie
clearCookie(name, [options])
  • express.res.redirect
redirect([status], url)
  • express.res.location
location(location)
  • express.res.charset
charset = 'value';
  • express.res.send
send([body|status], [body])
  • express.res.json
res.json([status|body], [body])
  • express.res.jsonp
jsonp([status|body], [body])
  • express.res.type
type(type)
  • express.res.format
format(object)
  • express.res.attachment
attachment([filename])
  • express.res.sendfile
sendfile(path, [options], [callback])
  • express.res.download
download(path, [filename], [callback])
  • express.res.links
links(linksMap)

LICENSE - "MIT License"

Copyright (c) 2013-2012 Luciano Colosio (@unlucio)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Bitdeli Badge

About

Some snippets hacked together for sublime text 2

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published