I hereby claim:
- I am ecasilla on github.
- I am erniecasilla (https://keybase.io/erniecasilla) on keybase.
- I have a public key ASBdSB8vESShvzF51b1dUXUPp_bNN7VQcjAYgjHKsr_Pkgo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
var vm = require('vm'); | |
var fs = require('fs'); | |
var path = require('path'); | |
/** | |
* Helper for unit testing: | |
* - load module with mocked dependencies | |
* - allow accessing private state of the module | |
* | |
* @param {string} filePath Absolute path to module (file to load) |
// eg https://github.com/cssnext/cssnext/labels | |
// paste this script in your console | |
// copy the output and now you can import it using https://github.com/ecasilla/github-labelmaker ! | |
var labels = [].slice.call(document.querySelectorAll(".label-link")) | |
.map(function(ele) { | |
return { | |
name: ele.textContent.trim(), |
# -*- mode: ruby -*- | |
# # vi: set ft=ruby : | |
require 'fileutils' | |
Vagrant.require_version ">= 1.6.0" | |
CLOUD_CONFIG_PATH = File.join(File.dirname(__FILE__), "user-data") | |
CONFIG = File.join(File.dirname(__FILE__), "config.rb") |
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
body { | |
margin: 0; | |
background: #222; | |
min-width: 960px; | |
} |
# The first term is the speed of light in meters per second | |
# (this is actually exact - a meter is defined as | |
# "the length of the path travelled by light in vacuum during a time interval of 1/299 792 458 of a second.". | |
# The second term, 100 is the number of centimeters in a meter. | |
# The third term, 1.0/1000000000 is one billionth. (Note that we need the .0 here (or at least 1.) | |
# to make Ruby do floating point division. Otherwise, 1/1000000000 would evaluate to 0.) | |
# So, the first three terms in the product compute the distance in centimeters |
The workflow we will follow looks like this:
import * as _ from 'lodash'; | |
function objectDiff(prev, now){ | |
// sanity checks, prev and now must be an object. | |
if ( ! _.isObject(prev) || ! _.isObject(now) ){ | |
return new TypeError("Arguments must both be objects",__filename); | |
} | |
var changes = {}; | |
for (var prop in now) { | |
// if property is new in now i.e unknown, add it too changes |
var heapdump = require('heapdump'); | |
//Grab a heapdump if the memory increase goes over 250mb | |
var nextMBThreshold = 0; | |
setInterval(function () { | |
var memoryMB = process.memoryUsage().rss / 1048576; | |
if (memoryMB > nextMBThreshold) { | |
heapdump.writeSnapshot(); | |
nextMBThreshold += 250; | |
} |
DOT = function(obj,prop){ | |
if(obj.hasOwnProperty(prop)){ | |
return obj[prop]; | |
}else if(obj.__proto__){ | |
return DOT(obj.__proto__,prop) | |
} | |
} | |
DOTCALL = function(obj,props,args){ | |
var fn = DOT(obj,props); |