Skip to content

Instantly share code, notes, and snippets.

View erikpukinskis's full-sized avatar

Erik Pukinskis erikpukinskis

View GitHub Profile
h1("There is no such thing as \"obvious code chnges\".")
p("You massively under-estimate the skill and experience involved in even the most basic programming tasks. Programming, version control, deployment, database design, systems design, etc. These people have their own professions with their own issues to deal with.")
global.wtf = function wtf(label, whatnot) {
if (!whatnot){
whatnot = label
label = undefined
}
if (typeof whatnot == "function") {
var out = whatnot.toString()
} else if (typeof whatnot == "object") {
if (Array.isArray(whatnot)) {
@erikpukinskis
erikpukinskis / spell.js
Last active November 20, 2016 04:59
forming a n-dimensional hypercube of course muahahahahaha
// is-everyone-free
// a-story
// tell-the-universe
// someone-is-a-person
// we-have-people-to-talk-to
tellTheUniverse(
"a-story",

In praise of callbacks

People talk about callbacks as if they are some sort of programming conundrum, because of "callback hell". The Parse blog has a nice example:

Parse.User.logIn("user", "pass", {
  success: function(user) {
    query.find({
      success: function(results) {
        results[0].save({ key: value }, {
element = require "nrtv-element"
component = require "nrtv-component"
BridgeTie = require "nrtv-bridge-tie"
ServerTie = require "nrtv-server-tie"
ElementTie = require "nrtv-element-tie"
GimmePizza = component(BridgeTie, ServerTie, ElementTie)
server = GimmePizza.server()
// Component
// Most people when they want to make something happen with software, need to
// pull together a couple different kinds of things. Maybe you want a button on
// your thing that when people hit it they can sign up for some text messages
// that are going to get sent to them according to some pattern. That's a couple
// different kinds of things: a widget people can interact with, some sort of
// off-line activity that springs to life and sends messages at particular
// times. A thing that remembers the phone numbers, etc.
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')