Skip to content

Instantly share code, notes, and snippets.

View jbfink's full-sized avatar
💭
we have statuses now? is this AOL?

John Fink jbfink

💭
we have statuses now? is this AOL?
View GitHub Profile
@jbfink
jbfink / gist:1648052
Created January 20, 2012 16:09
recursive part 3
var power = function (base, exponent) {
if (exponent === 0) {return 1;}
else
{ return base * power(base, exponent - 1);
}
};
@jbfink
jbfink / gist:1677929
Created January 25, 2012 19:03
codeyear lesson 7 question 2
var i = 2;
i--;
i--;
console.log( "i is equal to " + i );
@jbfink
jbfink / gist:1689522
Created January 27, 2012 16:08
404 from fillmore calendar add
bin/python fillmore.py
Traceback (most recent call last):
File "fillmore.py", line 167, in <module>
gcal.addEvent(config.user, header['Subject'])
File "fillmore.py", line 143, in addEvent
body = event).execute()
File "/home/jbfink/work/fillmore/local/lib/python2.7/site-packages/apiclient/http.py", line 307, in execute
raise HttpError(resp, content, self.uri)
apiclient.errors.HttpError: <HttpError 404 when requesting https://www.googleapis.com/calendar/v3/calendars/jbfinktest/events/quickAdd?text=party+at+phil%27s+place+8pm+february+19th&alt=json returned "Not Found">
@jbfink
jbfink / gist:1753485
Created February 6, 2012 17:26
fillmore dir
total 60
drwxr-xr-x 5 jbfink jbfink 4096 2012-02-06 11:27 .
drwxr-xr-x 23 jbfink jbfink 4096 2012-02-06 11:24 ..
drwxrwxr-x 2 jbfink jbfink 4096 2012-02-06 11:16 .cache
-rw-rw-r-- 1 jbfink jbfink 475 2012-02-06 11:17 calendar.dat
-rw-rw-r-- 1 jbfink jbfink 209 2012-02-06 11:16 config.cfg
-rw-rw-r-- 1 jbfink jbfink 177 2012-02-06 11:15 config.cfg.example
-rw-rw-r-- 1 jbfink jbfink 3846 2012-02-06 12:25 fillmore.log
-rw-rw-r-- 1 jbfink jbfink 5425 2012-02-06 11:13 fillmore.py
-rwxr-xr-x 1 jbfink jbfink 89 2012-02-06 11:27 fill-run.sh
@jbfink
jbfink / gist:1792359
Created February 10, 2012 20:05
codeyear week5, timetrials 2
// runner times
var carlos = [9.6,10.6,11.2,10.3,11.5];
var sarah = [10.6,11.2,9.4,12.3,10.1];
var timothy = [12.2,11.8,12.5,10.9,11.1];
var calculateAverage = function (raceTimes) {
var totalTime;
for ( i = 0; i < raceTimes.length; i++ ) {
totalTime = (totalTime || 0) + raceTimes[i];
@jbfink
jbfink / gist:1846756
Created February 16, 2012 18:00
fillmore.py error
Traceback (most recent call last):
File "/home/jbfink/work/fillmore/fillmore.py", line 163, in <module>
mailbox.read_inbox_headers()
File "/home/jbfink/work/fillmore/fillmore.py", line 70, in read_inbox_headers
self.inbox_headers.append(self.parse_message_headers(message_id))
File "/home/jbfink/work/fillmore/fillmore.py", line 83, in parse_message_headers
fields = header.split[0][1]("\r\n")
AttributeError: 'list' object has no attribute 'split'
@jbfink
jbfink / gist:2399639
Created April 16, 2012 15:56
error from fill-run
Traceback (most recent call last):
File "/home/jbfink/fillmore/fillmore.py", line 181, in <module>
mailbox.read_inbox_headers()
File "/home/jbfink/fillmore/fillmore.py", line 72, in read_inbox_headers
message_body = self.parse_body(message_id)
File "/home/jbfink/fillmore/fillmore.py", line 120, in parse_body
filename = datetime.now().strftime("%s") + "-" + filename
NameError: global name 'datetime' is not defined
@jbfink
jbfink / gist:2645102
Created May 9, 2012 14:55
chrome output
Chromium 18.0.1025.151 (Developer Build 130497) Ubuntu 11.10
OS Linux
WebKit 535.19 (trunk@106313)
JavaScript V8 3.8.9.16
Flash 11.2 r202
User Agent Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.19 (KHTML, like Gecko) Ubuntu/11.10 Chromium/18.0.1025.151 Chrome/18.0.1025.151 Safari/535.19
Command Line /usr/lib/chromium-browser/chromium-browser --flag-switches-begin --flag-switches-end
Executable Path /usr/lib/chromium-browser/chromium-browser
Profile Path /home/jbfink/.config/chromium/Default
@jbfink
jbfink / gist:2829910
Created May 29, 2012 18:30
my .gitconfig aliases section
[alias]
co = checkout
ci = commit
st = status
br = branch
ca = commit -am
fuckit = reset --hard
hist = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
type = cat-file -t
dump = cat-file -p
@jbfink
jbfink / string-palindrome.rb
Created July 6, 2012 15:07
monkeypatch String class for palindrome detection, strip spaces
class String
def palindrome?
junk = [",", "?", "!", ".", "'", '"', " ", "@", "#", "$", "%", "^", "&", "*"]
a = self.split("")
a.delete_if { |x| junk.include?(x) }
a.join.downcase == a.join.reverse.downcase
end
end