Skip to content

Instantly share code, notes, and snippets.

View gdoteof's full-sized avatar

geoff golder gdoteof

  • vision.ai
  • Burlington, VT
View GitHub Profile
@gdoteof
gdoteof / gist:2656632
Created May 10, 2012 23:49
Applicative Form to Tuple with Yesod Persistent
accountAddUserForm :: AccountId -> Form (Text, AccountId)
accountAddUserForm accountId = renderDivs $ (,)
<$> areq textField "User email address" Nothing
<*> pure accountId
@gdoteof
gdoteof / namecheap.rb
Created October 22, 2012 12:17 — forked from rboyd/namecheap.rb
namecheap api via httparty
require 'yaml'
require 'httparty'
settings = YAML::load_file(File.dirname(File.expand_path(__FILE__)) + '/namecheap.yml')
username = settings['namecheap']['user']
api_key = settings['namecheap']['api_key']
request_string = "https://api.namecheap.com/xml.response"
@gdoteof
gdoteof / btc-arb.py
Created April 2, 2013 21:40
Does some wonky parsing to get latest btc,ltc,usd info from btc-e.com and sees if there are discrepancies in the mutual ratios.
import httplib
import urllib
import json
pairs= {
'btc_usd' : "1",
'ltc_btc' : "10",
'ltc_usd' : "14"
}
@gdoteof
gdoteof / hm1.py
Created April 25, 2013 16:32
for hm #1
d = str(raw_input("Enter date"))
n = str(raw_input("Enter name"))
print n,d
@gdoteof
gdoteof / hm2.py
Created April 25, 2013 16:53
for hm2
def get_name():
name = str(raw_input("Enter your name: "))
return name
def get_birthday():
birthday = str(raw_input("Enter your birthdate: "))
return birthday
def output_name_and_birthday(name,birthday):
print "Your name is: ", name, " and your birthday is:", birthday
<?php
$zipfile = $_GET['zip'];
header('Content-Type: application/zip');
echo file_get_contents($zipfile);
?>
@gdoteof
gdoteof / letter_shift.rb
Last active December 25, 2015 05:19
Get the shifted/unshifted key for a standard US keyboard for each letter in a word
def shift_case(word)
lookup = {
'z' => 'Z',
'Z' => 'z',
'x' => 'X',
'X' => 'x',
'c' => 'C',
'C' => 'c',
'v' => 'V',
'V' => 'v',
@gdoteof
gdoteof / reddit comment lottery
Last active December 25, 2015 22:29
Reddit comment lottery. This is for those people that occasionally do lotteries in a reddit thread: "post here for a chance to ...." Known issues: doesn't include users that have comments now visible (ie.. if it says "load more comments" any users' comments that would have been loaded will not be included. this DOES however filter out users who …
var allusers = []; $('.author').map(function(key,item){if(allusers.indexOf(item.innerHTML) == -1) allusers.push(item.innerHTML);}); console.log(allusers.length + " users seen"); lucky_number = Math.floor(Math.random()*(allusers.length+1)); console.log("lucky number is " + lucky_number); lucky_user=allusers[lucky_number]; msg = "lucky user is " + lucky_user; console.log(msg); "http://www.reddit.com/u/" + lucky_user
@gdoteof
gdoteof / gist:7112784
Created October 23, 2013 04:53
NHL TEAM STAT GETTER - http://www.nhl.com/ice/teamstats.htm - DIRECTIONS: open up FIREFOX. go to the website. copy all the code below. go to tools -> web developer -> web console. paste in all the code elow into the text box in the console that pops up
var tableToExcel = (function() {
var uri = 'data:application/vnd.ms-excel;base64,'
, template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>{table}</table></body></html>'
, base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) }
, format = function(s, c) { return s.replace(/{(\w+)}/g, function(m, p) { return c[p]; }) }
return function(table, name) {
if (!table.nodeType) table = document.getElementById(table)
var ctx = {worksheet: name || 'Worksheet', table: table.innerHTML}
window.location.href = uri + base64(format(template, ctx))
}
@gdoteof
gdoteof / gist:7189561
Created October 28, 2013 00:22
Automatic five star rating for okcupid. this will just click 5 stars over and over forever.. adjust the 300 (in microseconds) to maike it go faster/slower
window.setInterval(function(){$(document.getElementById('stars').childElements()[4]).click()},300)