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
window.hudpad = window.hudpad || {}; | |
window.hudpad.scripts = window.hudpad.scripts || []; | |
window.hudpad.scripts.push({ | |
name: 'animation', | |
title: 'Demo Animation', | |
script: function (launch) { | |
// launch.showText('Hello There!'); | |
// launch.showText('My Name is Andrew!'); | |
// launch.showText('what is your name?'); | |
let x = 8; |
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
module.exports = function (plop) { | |
plop.setGenerator("test", { | |
description: "create a component", | |
prompts: [ | |
{ | |
type: "input", | |
name: "name", | |
message: "name" | |
} | |
], |
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
# vim:ft=zsh ts=2 sw=2 sts=2 | |
# | |
# agnoster's Theme - https://gist.github.com/3712874 | |
# A Powerline-inspired theme for ZSH | |
# | |
# # README | |
# | |
# In order for this theme to render correctly, you will need a | |
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts). | |
# Make sure you have a recent version: the code points that Powerline |
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
// input => [10, 3, 15, ...]; | |
function memoryBanks(input) { | |
const states = []; | |
let opCount = 0; | |
for (; !states.includes(input.join('|')) ;) { | |
states.push(input.join('|')); | |
const highestNum = Math.max.apply(null, input); | |
let idx = input.indexOf(highestNum); | |
let amt = input[idx]; | |
input[idx] = 0; |
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
// Day 5 - Challenge #1 | |
// input is an array of integers | |
function escapeHops(input) { | |
let hops = 0; | |
for (let pos = 0; pos < input.length;) { | |
const prevPos = pos; | |
pos += input[pos]; | |
hops += 1; | |
input[prevPos]++; | |
} |
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
// input is array of passphrases | |
input.filter( | |
phrase => phrase | |
.split(' ') | |
.every((word, idx, arr) => arr.indexOf(word) === idx) | |
).length; |
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
function getDist(num) { | |
let sqrt = Math.ceil(Math.sqrt(num)); | |
let sideLengthOfSq = (sqrt % 2 === 0 ? sqrt + 1 : sqrt); | |
let highestNumInSq = sideLengthOfSq * sideLengthOfSq; | |
let targetDistFromCorner = (highestNumInSq - num) % (sideLengthOfSq - 1); | |
let targetDistFromSideCenter = Math.abs(targetDistFromCorner - Math.floor(sideLengthOfSq/2)); | |
const closestDistFromSq = (sideLengthOfSq - 1) / 2; | |
return closestDistFromSq + targetDistFromSideCenter; | |
} |
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
// Day 1 - Challenge #1 | |
input.split('').reduce((acc, d, i, a) => { | |
const n1 = Number(d); | |
const n2 = Number(a[i+1] || a[0]); | |
return (n1 === n2 ? acc + n1 : acc); | |
}, 0); | |
// Day 1 - Challenge #2 | |
input.split('').reduce((acc, d, i, a) => { | |
const n2Pos = (i + (a.length / 2)) % a.length; |
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
/** | |
* glean - Access nested paths in an object whos structure we are uncertain of. | |
* Unholy marriage of Facebook's existential function and lodash get() | |
* https://facebook.github.io/react-native/blog/2017/03/13/idx-the-existential-function.html | |
* https://lodash.com/docs#get | |
* | |
* @param {Object} source the source object we are operating on | |
* @param {Function} accessor attepts to access the property desired | |
* @param {Any} defaultValue = null value to return if the accessor throws | |
* @return {Any} |
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
(function () { | |
var data = {}; | |
var dataLastSent = ''; | |
var listeners = []; | |
setInterval(genA, 1500); | |
setInterval(genB, 2270); | |
setInterval(genC, 5234); | |
genA(); |
NewerOlder