Skip to content

Instantly share code, notes, and snippets.

View jonallured's full-sized avatar
🥃
very nice code

Jon Allured jonallured

🥃
very nice code
View GitHub Profile
@jonallured
jonallured / gist:2154306
Created March 22, 2012 00:01
Modeling that app
class Player < ActiveRecord::Base
has_many :initiated_challenges, foreign_key: 'player_one_id', class_name: 'Challenge'
has_many :accepted_challenges, foreign_key: 'player_two_id', class_name: 'Challenge'
end
class Challenge < ActiveRecord::Base
belongs_to :player_one, class_name: 'Player'
belongs_to :player_two, class_name: 'Player'
has_many :games
urls = ["http://feedjira.com/blog/feed.xml", "http://jonallured.com/atom.xml"]
feeds = urls.map { |url| Feedjira::Feed.fetch_and_parse url }
feeds.map { |feed| feed.title }
# => ["Feedjira Blog", "Jon Allured"]
@jonallured
jonallured / feedjira.rb
Created February 5, 2015 21:42
Add common feed element
Feedjira::Feed.add_common_feed_element("image")
feed = Feedjira::Feed.fetch_and_parse("http://cltampa.com/tampa/Rss.xml?section=2065818")
feed.image
# => http://cltampa.com/binary/9697/adminIcon_clTampa.jpg
@jonallured
jonallured / heroku.html
Created January 7, 2015 15:27
Painzones
<!DOCTYPE html>
<html>
<head>
<title>PainZones</title>
<link rel="stylesheet" media="all" href="/assets/application-7eadaa6a15e069d84c07540345524b0e.css" data-turbolinks-track="true" />
<script src="/assets/application-9e487c229e80a9801080a510f15708b7.js" data-turbolinks-track="true"></script>
<meta name="csrf-param" content="authenticity_token" />
<meta name="csrf-token" content="Y07y3+TVyGsxAF0zE8Cu6Uaz2zdpb1OWZdeEnJVGTV+m0skCNPNMuTUTutwiPBghO01l+r6AjD9n72RIGHtFHg==" />
</head>
<body>
@jonallured
jonallured / hsync.sh
Created August 19, 2014 19:10
sync heroku dbs
#!/usr/bin/env bash
remote="${1:-staging}"
capture() {
heroku pgbackups:capture --expire --remote $1
}
url() {
heroku pgbackups:url --remote $1
}