Skip to content

Instantly share code, notes, and snippets.

var text = textr({ locale: 'ru' })
.use(markdown)
.use(escapeHTML)
.use(quotes)
;
function quotes(text, ctx) {
return _quotes(text, ctx);
}
@A
A / work.yml
Last active August 29, 2015 14:18
name: work
root: ~/Projects/work
windows:
- ED2:
layout: main-horizontal
panes:
- gulp
- sleep 3 && bundle exec foreman start
- zsh
generateProject()
.collect("all")
.toFile("_site/client.js")
.minify()
.concat()
.glob("src/*.js")
{
"disallowMultipleVarDecl": true,
"disallowPaddingNewlinesBeforeKeywords": [
"case",
"catch",
"do",
"else",
"for",
"function",
"if",
[{
"id": 0,
"name": "Sasha",
"age": 22
}, {
"id": 1,
"name": "Sasha",
"age": 24
}, {
"id": 2,
@A
A / git.sh
Last active August 29, 2015 14:16
git tips
# Git: list all conflict files
git ls-files -u
@A
A / splitByKeys.js
Last active August 29, 2015 14:15
convert string to array of ordinary strings and key-named strings
// convert string to array of ordinary strings and key-named strings
function splitByKeys(pattern) {
let regexp = /(:\w+)/g;
return pattern
.split(regexp)
// remove trailings
.filter(function(str) { return !!str; })
;
}
@A
A / traceur-and-6to5.md
Last active August 29, 2015 14:15
Benchmark for Traceur and 6to5(Babel) es6 transpilers

I had benchmarked traceur and 6to5 on my project. One thing about the project:

~/work/ed master ~(˘▾˘~) ❯ find . -name "*.js" -type f -not -path "./node_modules/*" -not -path "*/public/*" | xargs cat | wc -l
  5651

node_modules had excluded from compilation, then exclude it from our wc -l.

Benchmark source

@A
A / es6-classes.js
Last active August 29, 2015 14:14
Inheritance problems on ES2015 with properties before 'super'.
class View {
constructor() {
// require tagName and className to create element
}
}
class Input extends View {
constructor(...args) {
this.tagName = 'input';
this.className = 'form-control input';
@A
A / api.js
Created January 28, 2015 19:36
// Model for one pomodoro
var PomodoroModel = Backbone.Model.extend({
start: function () {},
countdown: function () {},
finish: function () {},
isFinished: function () {},
distract: function () {},
});
// Model for pomodoros collection