I hereby claim:
- I am nimamehanian on github.
- I am nimamehanian (https://keybase.io/nimamehanian) on keybase.
- I have a public key ASAJNQGxsMuKcxAzb0zoKZOkmklWfLI0xa4C7SND8G1d4go
To claim this, I am signing this object:
const gen0 = [ | |
[0, 1, 0, 0, 0, 0, 0, 0, 0, 0], | |
[0, 0, 0, 0, 0, 0, 1, 1, 0, 0], | |
[0, 0, 0, 1, 0, 0, 1, 0, 0, 0], | |
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], | |
]; | |
// CONWAY GAME OF LIFE — CONSTRAINTS: | |
// Any live cell with 0 or 1 live neighbors dies by underpopulation. | |
// Any live cell with 2 or 3 live neighbors stays alive. |
const makeChange = (tier, divisors) => { | |
if (!tier.length) { return false; } | |
const nextTier = tier.reduce((t, n) => | |
[...t, ...divisors.map(div => n - div)], [] | |
).filter(val => val > -1); | |
return nextTier.indexOf(0) === -1 ? | |
makeChange(nextTier, divisors) : true; | |
}; | |
makeChange([10], [3, 4]); |
const data = [6, 5, 8, 4, 7, 10, 9]; | |
const daysTillPlantDeath = (toxicities, daysElapsed) => { | |
const livingPlants = toxicities.filter((poisonLevel, idx) => ( | |
idx === 0 || (idx > 0 && poisonLevel <= toxicities[idx - 1]) | |
)); | |
return livingPlants.join('') === toxicities.join('') ? | |
daysElapsed : daysTillPlantDeath(livingPlants, daysElapsed + 1); | |
}; |
const flattenDeep = array => ( | |
array && array.constructor.name === 'Array' ? | |
array.toString().split(',').map(num => +num) : [] | |
); |
I hereby claim:
To claim this, I am signing this object:
// test strings | |
var str1 = 'the quick brown fox jumps over the lazy dog and this is probably the longest sentence you have ever come across because it just has so many words in it that it just runs on and on needlessly can you tell'; | |
var str2 = 'Oh, what a harmony of abandonment and impulse, of unnatural and yet graceful postures, in that mystical language of limbs, freed from the weight of corporeal matter, marked quantity infused with new substantial form, as if the holy band were struck by an impetuous wind, breath of life, frenzy of delight, rejoicing song of praise miraculously transformed, from the sound that it was, into image.'; | |
var rand = 'Oh, what a harmony of abandonment? and impulse!, of unnatural (and yet graceful) postures, in that mystical language of limbs, freed from the weight of corporeal matter, marked quantity infused with new substantial form; as if the holy band were struck by an impetuous wind, breath of life: frenzy of delight: rejoicing song of praise, miraculously transformed, fro |
var isResolvable = function (val) { | |
return val && typeof val.success === 'function'; | |
}; | |
var reference = function (data) { | |
if (isResolvable(data)) { return data; } | |
return { | |
success: function (callback) { | |
return reference(callback(data)); | |
} |
def palindrome?(text) | |
return true if text.length <= 1 | |
return false if text[0] != text[text.length - 1] | |
return palindrome?(text[1..-2]) | |
end | |
def prepare_range(number_of_digits) | |
big = '' | |
sml = '1' |
var stringifyJSON = function(object){ | |
// Base case: If not object and is a string, | |
// wrap in quotes and return. | |
// If not passed in (i.e., null), | |
// return empty string. | |
if(typeof object !== 'object' || object === null){ | |
if(typeof object === 'string'){ | |
object = '"' + object + '"'; | |
} | |
return String(object); |