Skip to content

Instantly share code, notes, and snippets.

View xavdid's full-sized avatar
🏠
Working from home

David Brownman xavdid

🏠
Working from home
View GitHub Profile
@xavdid
xavdid / Pasta
Last active December 22, 2015 04:18
The amount of time it takes to cook pasta is dependent on the altitude of the cooking environment. In mountainous areas, for example, the amount of boiling time should be increased to compensate for the lower boiling point achieved by the water. In other circumstances, boiling time can be decreased if cooking at altitudes below sea level. While this is true, in theory, very few locations habitable by humans exist at such low altitudes that they make a significant impact on the boiling temperature of the water. Hypothetically, if one were to boil water in the Marianas trench, one would only need to cook pasta for a mere fraction of the time that one would at sea level. 
How does this phenomenon affect one's lifestyle? In the case of frequent pasta-boilers, such as David Brownman, cooks (term used loosely) should keep track of their altitude at every possible moment to ensure the most accurately cooked al dente pasta. It is for this reason, the board strongly recommends the mandatory installation of altimeters
@xavdid
xavdid / grader.py
Last active December 22, 2015 08:18
Quidditch test grader script
import csv
cr = csv.reader(open("Quidditch Rules Quiz (Responses) - Form Responses.csv","rb"))
cr.next()
answers = cr.next()
# print answers
results = {}
totals = {'C':18,'B':18,'S':23,'R':25}
@xavdid
xavdid / rover.rb
Last active January 4, 2016 08:09
Mars Rover
=begin
### PROMPT ###
A squad of robotic rovers are to be landed by NASA on a plateau on Mars.
This plateau, which is curiously rectangular, must be navigated by
the rovers so that their on-board cameras can get a complete view of the
surrounding terrain to send back to Earth.
A rover's position and location is represented by a combination
@xavdid
xavdid / README.md
Last active August 29, 2015 13:56
Shirt Bouncer

#Shirt Bounce

A simple Sinatra app that acts as a step for an IFTTT recipe that parses Paypal emails about shirt orders and puts them into a database.

Read more about it here.

The live version is here.

@xavdid
xavdid / tttc.py
Last active August 29, 2015 13:56
Neat tic tac toe variant!
# A of tic-tac-toe-ception written on an airplane
class TTT:
def __init__(self, n):
#stuff
# 0,1,2,
# 3,4,5,
# 6,7,8
self.board = [
0,0,0,
@xavdid
xavdid / mwrc_rosters.rb
Created November 5, 2014 02:53
Make a roster from info pulled from quidditch-reference.com
require 'open-uri'
require 'nokogiri'
require 'pp'
require 'json'
# currently hardcoded for the MWRC event
def pull_players(team_code)
doc = Nokogiri::HTML(open("http://www.quidditch-reference.com/tournament/160/#{team_code}"))
rows = doc.xpath("//table//tr[position() > 1]")
team_name = doc.css("h2")[0].children[3].to_s
@xavdid
xavdid / get_price_drop.py
Last active August 29, 2015 14:11
Grabs an appshopper feed url and returns the most recent discount
# Given an appshopper url, find the most recent price drop
# author: David Brownman
# www: davidbrownman.com
# NOTE: the clipboard module is unique to pythonista.
import clipboard
import feedparser
import re
import webbrowser
@xavdid
xavdid / bad.rb
Last active August 29, 2015 14:27
Proof of concept for ruby refinements
class Fixnum
def dance
puts "I'M THE BEST DANCER"
end
end
@xavdid
xavdid / converter.rb
Last active March 10, 2016 21:02
Convert Salesforce 15 digit id to 18
class InvalidIdError < RuntimeError
end
def convert_to_18(id)
if id.nil?
return nil
elsif id.size != 15
puts "INVALID ID: #{id}"
raise InvalidIdError
end
@xavdid
xavdid / basic_server.rb
Created April 5, 2016 23:29
Dirt simple sinatra server
require 'sinatra'
require 'json'
get '/' do
'Hello, World!'
end
get '/data' do
{name: 'Sean', age: 24}.to_json
end