Skip to content

Instantly share code, notes, and snippets.

View ecancino's full-sized avatar

Eduardo Cancino ecancino

View GitHub Profile
@ecancino
ecancino / ambari_heatmap_json.rb
Last active May 26, 2017 13:41
Create heatmap json for Apache Ambari
#!/usr/bin/env ruby
require 'optparse'
class OptParse
# Return a dictionary describing the options.
#
def self.parse(args)
@ecancino
ecancino / update_all_repos.sh
Created September 22, 2014 21:58
update_all_repos.sh
#/usr/bin/bash
find ~/Repos -type d -maxdepth 1 \
-exec bash -c "cd '{}' && if [ -d \$PWD'/.git' ]; then \
echo 'Updating ' \$PWD; git pull origin master 2>/dev/null; fi" \
2>/dev/null \;
const numeronymize = (name) =>
[name[0], (name.slice(1, -1)).length, name[name.length - 1]].join('').toLowerCase()
console.log('Internationalization: ', numeronymize('Internationalization'))
console.log('Localization: ', numeronymize('Localization'))
console.log('Accessibility: ', numeronymize('Accessibility'))
console.log('Modularization: ', numeronymize('Modularization'))
console.log('Programming: ', numeronymize('Programming'))
console.log('Translation: ', numeronymize('Translation'))
console.log('Virtualization: ', numeronymize('Virtualization'))
@ecancino
ecancino / watchers.js
Created October 23, 2014 13:30
Too many watchers
(function () {
var root = $(document.getElementsByTagName('body'));
var watchers = [];
var f = function (element) {
if (element.data().hasOwnProperty('$scope')) {
angular.forEach(element.data().$scope.$$watchers, function (watcher) {
watchers.push(watcher);
});
}
angular.forEach(element.children(), function (childElement) {
@ecancino
ecancino / coolors.sass
Last active May 26, 2017 13:35
Coolors color scheme
// From http://coolors.co/5a0663-d2dcdd-2f1700-f22d00-83a9b2
$orange: #F22D00;
$blue: #83A9B2;
$brown: #2F1700;
$purple: #5A0663;
$gray: #D2DCDD;
@ecancino
ecancino / init_sharded_env.sh
Last active May 26, 2017 13:36
MongoDB Shard
#!/bin/sh
# Andrew Erlichson
# 10gen
# script to start a sharded environment on localhost
# clean everything up
echo "killing mongod and mongos"
killall mongod
killall monogs
@ecancino
ecancino / markdown.css
Last active May 26, 2017 13:37 — forked from imjasonh/markdown.css
Markdown.css
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
@ecancino
ecancino / countries.json
Last active August 29, 2015 14:25
Countries
[
{
"id": "AFG",
"alpha": "AF",
"name": "Afghanistan",
"date": "22-02-2007"
},
{
"id": "ALA",
"alpha": "AX",
@ecancino
ecancino / BackboneMixin.js
Created August 6, 2015 19:03
BackboneMixin
var BackboneMixin = {
componentDidMount: function () {
// Whenever there may be a change in the Backbone data, trigger a
// reconcile.
this.getBackboneCollections().forEach(function (collection) {
// explicitly bind `null` to `forceUpdate`, as it demands a callback and
// React validates that it's a function. `collection` events passes
// additional arguments that are not functions
collection.on('add remove change', this.forceUpdate.bind(this, null));
}, this);
@ecancino
ecancino / fizzbuzz.js
Last active May 26, 2017 13:38
Fizzbuzz
#!/usr/bin/env node
'use strict';
let _ = require('lodash');
const cicles = process.argv[2] || 100,
fizzbuzz = (n) => {
let word = '',
divideBy = _.curry((b, d) => (d !== 0) && (d % b === 0)),
divideBy3 = divideBy(3),