start new:
tmux
start new with session name:
tmux new -s myname
package main | |
import ( | |
"fmt" | |
"log" | |
"strings" | |
) | |
// Ops | |
const ( |
/* ES6/ES2015 classes */ | |
class A { | |
constructor() { | |
this.a = 10 | |
} | |
print() { | |
console.log(this.a, this.b) | |
} | |
} |
function mapValues(obj, fn) { | |
return Object.keys(obj).reduce((result, key) => { | |
result[key] = fn(obj[key], key); | |
return result; | |
}, {}); | |
} | |
function pick(obj, fn) { | |
return Object.keys(obj).reduce((result, key) => { | |
if (fn(obj[key])) { |
{ | |
// The block has begun, we're in a new block scope. The TDZ for the "a" binding has begun | |
var f = function() { | |
// 2. Because f() is evaluated before `a` is actually declared, | |
// an exception will be thrown indicating to the author that | |
// `a` is not yet defined. | |
console.log(a); | |
}; | |
/* Simple flexbox based grid system */ | |
$columns: 12; | |
@mixin layout-cols($device) { | |
@for $i from 1 through 12 { | |
.l-#{$device}-col-#{$i} { | |
flex: 0 0 $i / $columns * 100%; | |
} | |
} |
I will maybe someday get around to dusting off my C and making these changes myself unless someone else does it first.
Imagine a long-running development branch periodically merges from master. The
git log --graph --all --topo-order
is not as simple as it could be, as of git version 1.7.10.4.
It doesn't seem like a big deal in this example, but when you're trying to follow the history trails in ASCII and you've got several different branches displayed at once, it gets difficult quickly.
Why would you want to do this? Because you often don't need more. It's nice to not have to think about your "router" as this big special thing.
Instead, with this approch, your app's current pathname
is just another piece of state, just like anything else.
This also means that when doing server-side rendering of a redux app, you can just do:
var app = require('your/redux/app')
var React = require('react')
// use binary search to return index where given element needs to be inserted in the input array (must be sorted) | |
function binarySearchForInsertionIndex(arr, el, index = 0) { | |
const mid = ~~(arr.length / 2) | |
if (!arr.length || arr[mid] === el) return index | |
if (el < arr[mid]) return binarySearchForInsertionIndex(arr.slice(0, mid), el, mid + index - 1) | |
if (el > arr[mid]) return binarySearchForInsertionIndex(arr.slice(mid + 1), el, mid + index + 1) | |
} |
/* | |
# | |
# Example final output: | |
# | |
# 1000 main | |
# 1000 workLoop | |
# 900 read | |
# 900 __sys_read | |
# 100 parse | |
# 100 strcmp |