Skip to content

Instantly share code, notes, and snippets.

View tabruhn's full-sized avatar

Tyson Bruhn tabruhn

  • ex The University of Hong Kong
  • Seattle, WA
View GitHub Profile
@tabruhn
tabruhn / getChange.js
Last active January 20, 2016 17:29
Function to get correct change from a register.
/**
* Airbnb Style Guide refactor
* - set of pure composable functions for returning change of an amount from a register
* - all functions are pure, self-containing, side-effect free... enforcing the Airbnb immutable rule
* - each function is referential transparent, testable, parallelizable, cacheable
*/
/**
* takes an amount, an initial list, and a list of coins
/**
* Created by tyson on 14/1/2016.
*
* Process:
* My initial thought was to use the LinkedList API (java.util.LinkedList)
* This was a problem though, as the we need a singly linked list,
* java.util.LinkedList has the operations of a doubly linked list.
* So I created my own singly LinkedList for this assignment.
*
* The method I chose for finding the kth node from the end of the LinkedList
@tabruhn
tabruhn / preInfix.js
Last active November 19, 2015 20:35
Prefix to Infix Mathematical Conversion and Execution
/**
* Author: Tyson Bruhn
*
* @func
* @param {String} prefix The initial prefix string.
* @return {[String, Float]} An array with the infix string and the mathematical solution
* @example
* preInfix("+52-3"); //=> "["(5+2)-3",4]"
**/
set nocompatible " Must come first because it changes other options.
map <Leader>m <Plug>MakeGreen
let g:rubytest_in_quickfix = 1
let g:LustyJugglerSuppressRubyWarning = 1
silent! call pathogen#runtime_append_all_bundles()
syntax enable " Turn on syntax highlighting.
@tabruhn
tabruhn / HKEVENTS.rb
Last active April 6, 2022 03:28
Simple script to pull full year Eventbrite data for events in Hong Kong. Pulled information is output to a .csv file for convenience. Table fields are "Title" (event title), "Start Date", "Organizer", "Venue", "Address 1", "Address 2", "Event URL". The script asks for input of the users Eventbrite API 'User key' and 'App Key' and returns the eve…
#!/usr/bin/env ruby
require 'net/http'
require 'uri'
require 'json'
require 'csv'
require 'active_support/all'
auth = []
puts "API user key? "