Skip to content

Instantly share code, notes, and snippets.

View plural.js
var plural = function(number, one, two, five) {
var n = Math.abs(number);
n %= 100;
if (n >= 5 && n <= 20) return number + ' ' + five;
n %= 10;
if (n == 1) return number + ' ' + one;
if (n >= 2 && n <= 4) return number + ' ' + two;
@zerc
zerc / Backbone.Form.Validators.js
Created Jun 22, 2013
Some addition validators for Backbone.Form
View Backbone.Form.Validators.js
(function (Form) {
Form.validators.errMessages = {
youtube: 'Enter link from YouTube',
positive_int: 'Enter positive integer'
};
Form.validators.youtube = function(options) {
options = _.extend({
type: 'youtube',
message: this.errMessages.youtube,
View log_1
(venv)zero13cool@gantzer:~/repos/allinway$ cafe --nologo build --app_root=resources/cs --build_root=static/js --formula=recipe.yaml -f
Cafe> resolve: package.json's main file not found in dir /home/zero13cool/repos/allinway/resources/cs/node_modules/genome-parser/index.js
Cafe> resolve: package.json's main file not found in dir /home/zero13cool/repos/allinway/resources/cs/node_modules/dna-lang/lib-js/dna.js
Cafe> [Error: Cannot find module 'console-logger']
npm WARN package.json dna-lang@0.2.16 No repository field.
npm http GET https://registry.npmjs.org/genome-parser
npm http GET https://registry.npmjs.org/dna-lang
npm http GET https://registry.npmjs.org/console-logger
npm http 304 https://registry.npmjs.org/dna-lang
npm http 304 https://registry.npmjs.org/console-logger
@zerc
zerc / helper.py
Created Sep 17, 2013
Логирование трейсбека. И даже не спрашивайте зачем мне это :D
View helper.py
def D(fn):
import traceback
filename = 'trace'
def _(*args, **kwargs):
try:
return fn(*args, **kwargs)
except:
traceback.print_exc(5, open(filename, 'w'))
raise
return _
@zerc
zerc / example_git_filter_branch
Created Sep 28, 2013
Переписываем историю своего гит репозитория
View example_git_filter_branch
git filter-branch --tree-filter "find . \( -name 'filename1.py' -o -name 'filename2.sh' \) -exec sed -e \"s/password/fake_password/g\" -e \"s/api_key_secret/fake_key/g\" -i {} \;" HEAD --all
View Preferences.sublime_settings
{
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"ensure_newline_at_eof_on_save": true,
"file_exclude_patterns":
[
"*.pyc",
"*.pyo",
"*.exe",
"*.dll",
"*.obj",
View gist:f61441211c9ee4bd7a15
from collections import deque
import time
def timeit(method):
def timed(*args, **kw):
ts = time.time()
result = method(*args, **kw)
te = time.time()
print('{}, {}'.format(method.__name__, te-ts))
return result
@zerc
zerc / free_email_provider_domains.txt
Last active Jan 18, 2016 — forked from tbrianjones/free_email_provider_domains.txt
A list of free email provider domains. Some of these are probably not around anymore. I've combined a dozen lists from around the web. Current "major providers" should all be in here as of the date this is created.
View free_email_provider_domains.txt
1033edge.com
11mail.com
123.com
123box.net
123india.com
123mail.cl
123qwe.co.uk
150ml.com
15meg4free.com
163.com
You can’t perform that action at this time.