Skip to content

Instantly share code, notes, and snippets.

View kballenegger's full-sized avatar

Kenneth Ballenegger kballenegger

View GitHub Profile
@kballenegger
kballenegger / stock-value.rb
Last active August 29, 2015 13:56
Script to more easily get an idea of the current value of your stock at a company.
require 'date'
require 'json'
# assume standard 4-year vesting
# ignores cliff
# ignores vesting periods, assumes daily. (watch out for this)
unless price = ARGV[1]
puts "Must pass in price as second arg..."
exit 1
@kballenegger
kballenegger / ll-find-middle-node.c
Created February 14, 2014 05:09
Find the middle node in a linked list.
//
// File.c
//
//
// Created by Kenneth Ballenegger on 1/13/14.
//
//
#include <stdlib.h>
#include <stdio.h>

Keybase proof

I hereby claim:

  • I am kballenegger on github.
  • I am kballenegger (https://keybase.io/kballenegger) on keybase.
  • I have the public key with fingerprint 4969 7FB5 BF5B 01D1 147A  8199 5918 07DB 6738 9DC3

To claim this, I am signing this object:

char *const kCBLocationAtStartupString = "startup";
// etc ...
typedef enum CBLocation {
CBLocationAtStartup = (char *const)"startup",
// etc.
} CBLocation;
void showInterstitial(CBLocation location) {
char *locationString = (char *)location;
@kballenegger
kballenegger / xcode.crash
Created March 10, 2014 19:32
Xcode crashes on unit tests... wtf.
Process: Xcode [7919]
Path: /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 5.0.1 (3335.6)
Build Info: IDEApplication-3335006000000000~3
Code Type: X86-64 (Native)
Parent Process: launchd [247]
Responsible: Xcode [7919]
User ID: 501
@kballenegger
kballenegger / CBJSONCollectionDescriptions.m
Last active August 29, 2015 13:57
Apple's default way of describing collections seriously blows. JSON is better.
//
// CBJSONCollectionDescriptions.m
// Chartboost
//
// Created by Kenneth Ballenegger on 3/12/14.
//
//
#import "CBJSONCollectionDescriptions.h"
#import <objc/runtime.h>
@kballenegger
kballenegger / quoth-api-spec.md
Last active August 29, 2015 13:57
Quoth API Spec

API Spec

Standard stuff

Every request should contain the following headers:

  • Quoth-Client: an user-agent type string, eg. Quoth-iOS 3.2
  • Quoth-Authentication: a json object, like this:
@kballenegger
kballenegger / routes-deprecated.rb
Last active August 29, 2015 14:00
Overriding wrapping routes with a deprecation message.
require 'kenji'
module Kenji
class Controller
class << self
def routes_deprecated!(enabled = true)
if enabled
puts "Enabling deprecation for the following methods in #{self.name}:"
else
@kballenegger
kballenegger / Vagrantfile
Created May 9, 2014 19:19
Vagrant+Docker networking problems.
# The two above specifies which version of the vagrant API is used.
Vagrant.configure('2') do |config|
# This is a hack around the networking slowness in the VM.
config.vm.provider 'virtualbox' do |vb|
vb.customize ['modifyvm', :id, '--natdnshostresolver1', 'on']
vb.customize ['modifyvm', :id, '--natdnsproxy1', 'on']
vb.customize ['modifyvm', :id, '--natpf1', 'app,tcp,,9977,,9977']
end
@kballenegger
kballenegger / Makefile
Created June 20, 2014 01:49
make build rules
# NOTE: There are two root files which are the entrypoints to compilation for
# both JavaScript and CSS. Those files are:
#
# src/js/app.{js,wisp,jsx}
# src/style/style.scss
# Tools
SHELL := /bin/bash
JSX ?= jsx