Skip to content

Instantly share code, notes, and snippets.

View yanatan16's full-sized avatar

Jon Eisen yanatan16

View GitHub Profile
@yanatan16
yanatan16 / pebble-discs.c
Last active August 29, 2015 13:56
Pebble Discs Walkthrough
#include <pebble.h>
#include <time.h>
static const int FACE_DISC_RADIUS = 70;
static const int CENTER_DISC_RADIUS = 20;
static const int HOUR_DISC_RADIUS = 10;
static const int MINUTE_DISC_RADIUS = 5;
static const int HOUR_ROT_RADIUS = 40;
static const int MINUTE_ROT_RADIUS = 60;
@yanatan16
yanatan16 / me.joneisen.playmusiconstartup.plist
Created March 5, 2014 18:28
me.joneisen.playmusiconstartup.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>RunAtLoad</key>
<true/>
<key>Label</key>
<string>me.joneisen.playmusiconstartup</string>
<key>ProgramArguments</key>
<array>
@yanatan16
yanatan16 / transistor_function_combinations.py
Created May 21, 2014 17:43
Calculate the number of ability combinations from function usage in Transistor. (answer: 22 billion)
#!/usr/bin/env python3
from math import factorial
def combinations(n):
''' Given n functions to be selected, return how many combinations for selecting those functions there are '''
return int(factorial(16) / factorial(16-n))
def get_all_combinations():
'''
@yanatan16
yanatan16 / README.md
Created June 12, 2014 19:22
Testing engine.io-client 1.0 on android
  • Clone engine.io-client
git clone https://github.com/Automattic/engine.io-client
cd engine.io-client
npm install
  • Start a test server
ZUUL_PORT=8080 node test/support/server.js
@yanatan16
yanatan16 / scale.md
Created July 27, 2014 02:29
Presentation on Scale

Scale

Scale is a buzzword for growth in the tech industry, but it has so many meanings. Let's dig into them to see what scale really means!

Scaling means you are increasing the responsibility or load of a system.

How do we, as web developers, handle the increased load?

  1. Increase Concurrency
  2. Distribute load across mulitple servers
@yanatan16
yanatan16 / gist:b0876cacee93dddf074b
Last active August 29, 2015 14:04
widget notes
# widget
## Customizable layout/templates
- Customization really involves every aspect of user interaction
- embed code embeds both template and configuration
- config might be shortcoded, encoded, or plain
_PUSHED_ Custom Entry Options
@yanatan16
yanatan16 / for_var_scoping.js
Created August 8, 2014 20:17
Where js's for-loop var leaking is bad
var arr = [1,2,3,4];
for (var i = 0, len = arr.length; i < len; i++) {
var el = arr[i];
setTimeout(function () {
console.log(el);
}, 10);
}
@yanatan16
yanatan16 / goooal.js
Created August 12, 2014 22:17
functional.goooooal.js
// this a lazy evaluation of the delayed value
// If the delayed value is delayed (i.e. a function), then return a function that will resolve eventually
// If not, then resolve immediately and prefix
function resolve(prefix, delayed_value) {
if (typeof delayed_value === 'function')
return function (a) { return resolve(prefix, delayed_value(a)) }
else
return prefix + delayed_value
}
@yanatan16
yanatan16 / transducers.js
Created September 23, 2014 05:14
TRANSducers!
// function reducing(acc, next) {
// return next_acc
// }
// function transducing(reducing) {
// return more_reducing
// }
// Example reducer (without transducers)
@yanatan16
yanatan16 / de_async.clj
Last active August 29, 2015 14:22
de-async: Channel that returns channels
(require '[clojure.core.async :refer (go go-loop <! >! >!! chan close! alts!)])
(defn de-async
"From is a channel of channels.
Returns a new channel that has the values of the channels.
Closes when all channels are closed."
[from]
(let [to (chan)]
(go-loop [cs [from]]
(if-not (empty? cs)