Skip to content

Instantly share code, notes, and snippets.

View wookimiii's full-sized avatar

Andrew Kim wookimiii

View GitHub Profile
@wookimiii
wookimiii / allPromises.js
Last active November 20, 2018 17:14
All Promises using an object instead of an array
function allPromises(promises) {
let keys = []
let values = []
Object.entries(promises).forEach(entry => {
keys.push(entry[0])
values.push(entry[1])
})
return Promise.all(values).then(resultsArray => {
let results = {}
resultsArray.forEach((result, index) => {
@wookimiii
wookimiii / timer.html
Created April 13, 2017 21:15
A timer for sermons
<!DOCTYPE html>
<html>
<head>
<script src='https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/moment.min.js' type='text/javascript' ></script>
<script src="https://unpkg.com/vue"></script>
<style>
body {
color: #CCC;
background-color: black;
font-family: Arial, Helvetica, sans-serif;

#Node Modules are AWESOME Andrew Kim Consumer Web Developer


#Big Apps require big code

{"server":"","id":"pagespeedtest_test","domain":"http://www.yellowpages.com","result":"success","message":{"kind":"pagespeedonline#result","id":"http://www.yellowpages.com/","responseCode":200,"title":"YP.com - Yellow Pages, the new yellowpages.com","score":69,"pageStats":{"numberResources":182,"numberHosts":70,"totalRequestBytes":"41916","numberStaticResources":83,"htmlResponseBytes":"153542","textResponseBytes":"446","cssResponseBytes":"209367","imageResponseBytes":"1343633","javascriptResponseBytes":"1904194","otherResponseBytes":"24261","numberJsResources":29,"numberCssResources":4},"formattedResults":{"locale":"en_US","ruleResults":{"AvoidLandingPageRedirects":{"localizedRuleName":"Avoid landing page redirects","ruleImpact":0,"urlBlocks":[{"header":{"format":"Your page has no redirects. Learn more about avoiding landing page redirects.","args":[{"type":"HYPERLINK","value":"https://developers.google.com/speed/docs/insights/AvoidRedirects"}]}}]},"EnableGzipCompression":{"localizedRuleName":"Enable compress
@wookimiii
wookimiii / assimilateTest.js
Created September 19, 2014 21:58
testing to see how the package assimilate js works
'use strict';
var assimilate = require('assimilate').withStrategy('proper');
function a(name) {
this.name = name;
}
a.prototype.greet = function () {
return "Hi, I'm " + this.name;
@wookimiii
wookimiii / output.txt
Created July 15, 2014 19:11
Browserify build times
Tue Jul 15 12:10:35 PDT 2014
NODE_PATH=./node_modules:. ./node_modules/.bin/browserify -t brfs -e public/ypu/js/bundles/auth.js > public/ypu/js/compiled/auth.js
Tue Jul 15 12:10:37 PDT 2014
NODE_PATH=./node_modules:. ./node_modules/.bin/browserify -t brfs -e public/ypu/js/bundles/delivery.js > public/ypu/js/compiled/delivery.js
Tue Jul 15 12:10:37 PDT 2014
NODE_PATH=./node_modules:. ./node_modules/.bin/browserify -t brfs -e public/ypu/js/bundles/desktop.js > public/ypu/js/compiled/desktop.js
Tue Jul 15 12:10:39 PDT 2014
NODE_PATH=./node_modules:. ./node_modules/.bin/browserify -t brfs -e public/ypu/js/bundles/directions.js > public/ypu/js/compiled/directions.js
Tue Jul 15 12:10:40 PDT 2014
NODE_PATH=./node_modules:. ./node_modules/.bin/browserify -t brfs -e public/ypu/js/bundles/dlp.js > public/ypu/js/compiled/dlp.js
@wookimiii
wookimiii / percubes.erl
Created May 9, 2014 21:52
Erlang solution to the cube permutation problem
% permcubes.erl
%
% Problem statement:
% The cube, 41063625 (345^3), can be permuted to produce two other cubes: 56623104 (384^3) and 66430125 (405^3).
% In fact, 41063625 is the smallest cube which has exactly three permutations of its digits which are also cube.
% Find the smallest cube for which exactly five permutations of its digits are cube.
%
% Usage: permcubes:find(N) where N is the number of permutations
% permcubes:find(N). => [127035954683,352045367981,373559126408,569310543872, 589323567104]
@wookimiii
wookimiii / gist:10786659
Created April 15, 2014 23:02
bento call
http://qa1-rservices.int.yp.com:7002/consumer/search?q=stocks%20%26%20bond%20brokers&record_history=true&s=relevance&p=1&img_paths=true&g=Mobile%2C%20AL&h=30&orig_ip=127.0.0.1&orig_user_agent=Mozilla%2F5.0%20(Macintosh%3B%20Intel%20Mac%20OS%20X%2010_8_5)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F34.0.1847.116%20Safari%2F537.36&allow_closed_businesses=true&flimit=30&sales_debug=false&rq=true&catexp_results=1&search=learch&fmlp=0&facets%5B%5D=ambiance&facets%5B%5D=average_rating&facets%5B%5D=features&facets%5B%5D=geo_distance&facets%5B%5D=heading_text&facets%5B%5D=listing_name&facets%5B%5D=neighborhood&facets%5B%5D=price_range&spellcheck=true&chain_collapse=true&app_version_key=SRPNew&from=&site=vendetta&qt=&vrid=3004dab0-b62c-48a9-89ec-8271cbfcd2a3&rid=webyp-09e57b77-07e5-4bda-85f4-4fe251758e49&app_id=WEB&ptid=yo&orig_referrer=http%3A%2F%2Fdev.yellowpages.com%3A3000%2Fmobile-al%2Fstocks-bond-brokers%3Fg%3DMobile%252C%2520AL%26q%3Dstocks%2520bond%2520brokers
@wookimiii
wookimiii / torn-brute.js
Created April 15, 2014 19:24
Torn number
var a, b, s;
for (var i=1000; i < 9999; i++) {
s = Math.sqrt(i);
if (s%1 == 0) {
a = Number(i.toString().substring(0, 2));
b = Number(i.toString().substring(2, 4));
if ( a + b == s) {
console.log(a, b);
}
}
@wookimiii
wookimiii / handleError.js
Created February 22, 2014 00:10
A wrapper function to handle errors
function handleError(callback) {
return function(err, data) {
if (err) {
console.trace(err);
res.send(500);
} else {
callback(null, data);
}
}
}