Just a dump of handy live templates I use with IntelliJ. They should also work with WebStorm.
- Go to
settings
. - Search for
live templates
. - Under the javascript section you should be able to manage your templates.
from time import sleep | |
from tornado.httpserver import HTTPServer | |
from tornado.ioloop import IOLoop | |
from tornado.web import Application, asynchronous, RequestHandler | |
from multiprocessing.pool import ThreadPool | |
_workers = ThreadPool(10) | |
def run_background(func, callback, args=(), kwds={}): | |
def _callback(result): |
# use with: logging.config.dictConfig(yaml.load(open('logging.yaml', 'r'))) | |
# Formatters detailed here: http://docs.python.org/2/library/logging.html#logrecord-attributes | |
version: 1 | |
formatters: | |
simple: | |
format: '%(asctime)s - %(name)s - %(levelname)s - %(message)s' | |
detail: | |
format: '%(asctime)s - %(levelname)s - File: %(filename)s - %(funcName)s() - Line: %(lineno)d - %(message)s' |
#!/bin/sh | |
rpm -Uih https://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm | |
curl -L https://get.rvm.io | bash -s stable | |
rvm install 2.0.0 | |
rvm use 2.0.0@global --default | |
# for chinese user, if you have a wonderful speed ignore this part | |
# to have a faster download speed | |
# switch gem source to ruby.taobao.org |
// ... | |
function checkBelongsTo(installationId, userId, cb) { | |
Installation.findById(installationId, function (err, inst) { | |
cb(err, !err && inst && inst.userId == userId); | |
}); | |
} | |
var ERR_403 = new Error("Forbidden"); | |
ERR_403.status = ERR_403.statusCode = 403; |