Skip to content

Instantly share code, notes, and snippets.

View joho's full-sized avatar
At harbour

John Barton joho

At harbour
View GitHub Profile
@joho
joho / layout.html.erb
Created August 24, 2012 06:30
Doing custom facebook JS api stuff while loading their API async (from the layout).
<body>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'YOUR_APP_ID', // App ID
status : true, // check login status
});
// check if the view has registered an "after facebook load callback"
if(typeof window.appSpecificFbAsyncInit == 'function') {
@joho
joho / student_report.c
Created August 18, 2012 10:13
An assignment from my first C class way back in 2002
/*
* John Barton
* 201165023
* jrba@deakin.edu.au
*
* The purpose of this program is to read a file, do some things with the data
* in that file, then output the results into another file.
*
* About the only thing i learnt about software development from this is that
* sitting down to do some "proper" pseudocode does me no good, when i look
@joho
joho / gist:3173467
Created July 24, 2012 23:50
googlebot mobile useragent
Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B117 Safari/6531.22.7 (compatible; Googlebot-Mobile/2.1; +http://www.google.com/bot.html)
@joho
joho / dabblet.css
Created July 12, 2012 04:44
Fuckin' list stylin'
/**
* Fuckin' list stylin'
*/
li {
list-style-type: none;
margin-top: 5px;
}
li:before {
@joho
joho / dabblet.css
Created May 18, 2012 06:48 — forked from anonymous/dabblet.css
Goodfilms New Header
/**
* Goodfilms New Header
*/
/* Rectangle 4: */
.box {
background: #FFA700;
width: 960px;
height: 100px;
when_john_fucked_up = Time.new(2012, 4, 3, 2) # 2am the 3rd april UTC = roughly when i ran the emails in dev
EmailSubscription.where(:user_id => user_ids_sent_from_dev).map do |email_subscription|
email_subscription.update_attribute(:last_sent_at, when_john_fucked_up)
end
class AddEmailSubscriptions < ActiveRecord::Migration
def up
# ...SNIP... irreversible code
end
def down
raise "once you've gone black"
end
end
@joho
joho / deploy.rb
Created March 8, 2012 10:48
Fix 'Host key verification failed.' errors by using this cap task
# Add this to your capfile if you're getting burned on first deploy to a new host
# If you're getting 'Host key verification failed.' errors on your initial
# checkout of a repo using capistrano, this will fix it up
task :a_friend_of_mine_is_a_friend_of_yours do
# transfer what *I* know about github to the host
github_known_hosts_line = `cat ~/.ssh/known_hosts | grep github.com`
run "echo #{github_known_hosts_line} >> ~/.ssh/known_hosts"
end
@joho
joho / fix_all_the_encodings.rb
Created February 15, 2012 22:15
My foolproof upgrade path from ruby 1.8 to 1.9
ObjectSpace.each_object do |object|
object.force_encoding("utf-8") if object.respond_to?(:force_encoding)
end
Note: For bist efict, rid these out loud!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Milbun – Capital of Victoria
Peck – To fill a suitcase
Pissed aside – Chemical which kills insects
Pigs – For hanging out washing
Pug – Large animal with curly tail
Nin tin dough – Computer game
Munner stroney – Soup
Min – Male of the species