Skip to content

Instantly share code, notes, and snippets.

View erikpukinskis's full-sized avatar

Erik Pukinskis erikpukinskis

View GitHub Profile
var request = {
values: new HashTable, // https://github.com/BorisKozo/jsHash
cache: function(func) {
if (value = values.get(func)) {
return value
}
var args = Array.prototype.slice(arguments, 1)
var value = func.apply(null, args)
values.set(func, value)
return value
@erikpukinskis
erikpukinskis / teacup_component_demo.coffee
Last active August 29, 2015 14:17
Teacup Component Demo
{render, component, div, button, label, span, text} = require 'teacup'
{prettyPrint} = require 'html'
html = render ->
# You can do this. Whether you should do this is up to you.
require 'stripe'
Stripe.api_key = "yr key heer"
# This will cancel all of the subscriptions in your Stripe account. Money corrupts.
$start_at
$found_one = true
while $found_one
puts 'Batch after ' + ($start_at ? $start_at : 'no one')
function scrollToReveal(selector) {
MINIMUM = 50
function scrollTowards(edge) {
var distance = distanceTo(edge, selector)
if (distance > MINIMUM) { return }
var offset = distance - MINIMUM
var direction = directionTowards(edge)
var newPosition = $('body').scrollTop() - direction * offset

Narrator

Forward

The ambition of software development is to create a story that can be easily understood by both a person and a computer. Why not go all in and just write documents that can be read by both beast and machine? Donald Knuth calls this "Literate Programming".

I'm going to try to figure out how Literate Programming might work for web apps by making a web app for writing narrative web apps called Narrator. Here we go!

App = Ember.Application.create();
App.Router.map(function() {
this.route('producer', {path: '/producer'});
});
App.ProducerTileView = Ember.View.extend({
classNameBindings: ['selected'],
click: function() {
<html>
<head>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<style>
.slides {
overflow: hidden;
white-space: nowrap;
}
def translate(english)
english.gsub(/[A-Za-z]+/) do |word|
translate_word(word)
end
end
def translate_word(english)
first = english[0]
remainder = english[1, english.length]
pig = remainder + first.downcase + 'ay'
# These are the coefficients that R gives me from my logistic regression:
intercept = 0.2700309
coefficients = {
high: 1.0136028,
low: 1.0016712,
germ_mean: 1.0233327,
gdds: 0.9990283,
early_gdds: 0.9986464,
mid_gdds: 1.0002979,
@erikpukinskis
erikpukinskis / licks.tab
Last active December 30, 2015 13:49
Licks
E|--7--5--5--7--5--
B|--8--0--5--5--5--
G|--0--7--5--------
D|-----------------
A|-----------------
E|-----------------
GBEB GBEB GBEB EB EB