Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Ernie Casilla ecasilla

🏠
Working from home
Block or report user

Report or block ecasilla

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View sinon_match_generator.js
const input = {
x: 'hello world',
y: 2,
f: true,
z: {
a: [1,2,3],
b: new Set([1,2,3]),
c: new Map([['hello', 'world']]),
d: null,
e: undefined
@ecasilla
ecasilla / cloudSettings
Last active Jul 15, 2019
Vscode Settings
View cloudSettings
{"lastUpload":"2019-07-15T16:05:26.337Z","extensionVersion":"v3.4.0"}
View keybase.md

Keybase proof

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:

@ecasilla
ecasilla / extract.js
Created May 14, 2016
Extract Github Issues Lables
View extract.js
// 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(),
View Vagrantfile
# -*- 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")
@ecasilla
ecasilla / calculator.js
Created Sep 22, 2015
Awesome Calculator
View calculator.js
function Calculator() {}
function reduceArgs(operation) {
return function() {
var args = Array.prototype.slice.call(arguments);
var ops = {
'+': function(x, y) {
return x + y;
},
'-': function(x, y) {
@ecasilla
ecasilla / tools.js
Created Aug 25, 2015
Node js prod tools
View tools.js
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;
}
@ecasilla
ecasilla / define.js
Created Jul 16, 2015
module definition in all envs
View define.js
if (typeof module !== 'undefined' && module.exports) {
module.exports = myModule;
} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd){
// AMD. Register as an anonymous module.
define(function () {
return myModule;
});
} else {
window.myModule = myModule;
}
@ecasilla
ecasilla / dot.js
Last active Aug 29, 2015
DOT operator
View dot.js
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);
@ecasilla
ecasilla / object_diff.js
Last active Nov 19, 2015
Js Object Diff
View object_diff.js
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
You can’t perform that action at this time.