using level-sublevel, level-sec and validimir to have
- validations
- schema documentation
- schema enforcement
- index definitions
## Update! Found an alternative approach that's concise and feels much more idiomatic | |
def compose (f, g): | |
return lambda x: f(g(x)) | |
def comp(*args): | |
return reduce(compose, args[1:], args[0]) | |
def comp1(*args): |
using level-sublevel, level-sec and validimir to have
Hi there!
The docker cheat sheet has moved to a Github project under https://github.com/wsargent/docker-cheat-sheet.
Please click on the link above to go to the cheat sheet.
var decode = function decode(bytes) { | |
var points = []; | |
var i = 0, j = 0; | |
while (i < bytes.length) { | |
if ((bytes[i] & 0x80) === 0) { | |
points.push(bytes[i] & 0x7f); | |
i += 1; | |
} else if ((bytes[i] & 0xE0) === 0xC0) { | |
points.push(((bytes[i] & 0x1F) << 6) + (bytes[i+1] & 0x7f)); |
There was a [great article][1] about how react implements it's virtual DOM. There are some really interesting ideas in there but they are deeply buried in the implementation of the React framework.
However, it's possible to implement just the virtual DOM and diff algorithm on it's own as a set of independent modules.
var request = require('request') | |
, json = require('JSONStream') | |
, through2 = require('through2') | |
, csv = require('csv-write-stream') | |
, zlib = require('zlib') | |
, fs = require('fs') | |
request({url: 'https://registry.npmjs.org/-/all'}) | |
.pipe(json.parse('*')) | |
.pipe(through2.obj(function (data, enc, callback) { |
sudo apt-get install btrfs-tools | |
sudo su | |
mkdir /data | |
cd /data | |
# create 500 MB file | |
dd if=/dev/zero of=/data/datadisk bs=1024 count=500000 | |
# create btrfs |
The prep-script.sh
will setup the latest Node and install the latest perf version on your Linux box.
When you want to generate the flame graph, run the following (folder locations taken from install script):
sudo sysctl kernel.kptr_restrict=0
# May also have to do the following:
# (additional reading http://unix.stackexchange.com/questions/14227/do-i-need-root-admin-permissions-to-run-userspace-perf-tool-perf-events-ar )
sudo sysctl kernel.perf_event_paranoid=0
$ git clone https://github.com/heroku/heroku-buildpack-ruby.git # or any other buildpack
$ cd heroku-buildpack-ruby
heroku-buildpack-ruby $ cat Dockerfile
FROM fabiokung/heroku-buildpack-base
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y -q ruby2.0
# more stuff specific to this buildpack...