This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
eval(atob('0xF14e/0xF144/0xF141/0xF173/0xF14e/0xF144/0xF141/0xF173/0xF14e/0xF144/0xF145/0xF173/0xF14e/0xF16a/0xF145/0xF173/0xF14e/0xF16a/0xF149/0xF173/0xF14d/0xF17a/0xF16b/0xF173/0xF14d/0xF154/0xF141/0xF135/0xF14c/0xF144/0xF145/0xF177/0xF14d/0xF153/0xF177/0xF178/0xF14d/0xF144/0xF16b/0xF173/0xF14d/0xF154/0xF141/0xF178/0xF14c/0xF144/0xF145/0xF178/0xF14e/0xF153/0xF177/0xF17a/0xF14f/0xF153/0xF177/0xF130/0xF14d/0xF153/0xF177/0xF130/0xF14d/0xF143/0xF177/0xF130/0xF14d/0xF151/0xF13d/0xF13d'.split('/').map(l => l.split('0xF1')[1]).map(n => parseInt(n, 16)).map(n => String.fromCharCode(n)).join('')).split(',').map(n => String.fromCharCode(n)).join('')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Fetch nested properties, returns undefined instead of throwing error. | |
@example | |
const obj = { deep: { nested: stuff: 1 } } | |
dig(obj, 'deep.something.something.darkside') #=> undefined | |
*/ | |
function dig (o, p, c = 0) { | |
const ps = p.split('.'), cr = ps[c] | |
return ps.length - 1 === c ? undefined : typeof o[cr] === 'object' && !o[cr] instanceof Array ? dig(o[cr], p, c + 1) : o[cr] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @author John Molina <[email protected]> | |
* Creates a Survey class that gathers data based on chosen answers and returns | |
* a key object that will be mapped against a dictionary of answers. | |
* @class | |
* @param {Object} answers | |
*/ | |
class Survey extends EventEmitter { | |
constructor(answers) { | |
super() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add this line to ~/.gitconfig in [alias]. | |
dif = "!sh -c \"git diff $(git diff --name-only -- \"*$1*\")\"" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'mouse:move': function(event) { | |
if (mouse_down_status) { | |
var grouped_path = []; | |
var points = canvas.freeDrawingBrush.convertPointsToSVGPath(canvas.freeDrawingBrush._points); | |
points = points.filter(function(n){ return n != ' ' }); | |
points.map(function(e, i) { | |
if (typeof points[i] == 'string') { | |
points[i] = points[i].replace(/ /g,''); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include Math | |
require "bigdecimal/math" | |
include BigMath | |
# Sum all odd PI digits from 1 to 31415 | |
PI(31415).to_digits.tr('.', '').split('').select.each_with_index {|s, i| i.even?}.tap {|x| p x.map(&:to_i).inject(0, &:+)} |