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 / cooney.rb
Created May 14, 2018 13:38
Loop with Feedjira
feed_urls = ["http://jonallured.com/atom.xml", "http://feedjira.com/blog/feed.xml"]
feed_urls.each do |feed_url|
feed = Feedjira.fetch_and_parse(feed_url)
# ...do something with feed here
end
@jonallured
jonallured / config.yml
Created December 20, 2017 19:27
Volt Circle 2.0 Config
version: 2
base: &base
working_directory: ~/volt
docker:
- image: artsy/volt-testing
environment:
RAILS_ENV: test
- image: redis:3.2.10-alpine

Keybase proof

I hereby claim:

  • I am jonallured on github.
  • I am jonallured (https://keybase.io/jonallured) on keybase.
  • I have a public key ASDIy4lphHm60JjToM2NO94NkQoV5upYab3eAga3ocPZDgo

To claim this, I am signing this object:

import urllib.request, json
def lambda_handler(_event, _context):
with urllib.request.urlopen("https://daringfireball.net/feeds/json") as url:
data = json.loads(url.read().decode())
keys = ["id", "url", "title", "date_published"]
items = data["items"]
new_items = []
@jonallured
jonallured / ViewController.swift
Created June 19, 2015 13:44
In-App WAC with Swift and unsafeBitCast
import UIKit
import ExternalAccessory
class ViewController: UIViewController, EAWiFiUnconfiguredAccessoryBrowserDelegate {
var accessoryBrowser: EAWiFiUnconfiguredAccessoryBrowser?
override func viewDidLoad() {
super.viewDidLoad()
accessoryBrowser = EAWiFiUnconfiguredAccessoryBrowser.init(delegate: self, queue: nil)
accessoryBrowser?.startSearchingForUnconfiguredAccessoriesMatchingPredicate(nil)
@jonallured
jonallured / detention.rb
Created March 26, 2016 13:57
The Breakfast Club written and directed by John Hughes
require 'net/http'
class BratBot
def initialize(name, bot_id, delay)
@name, @bot_id, @delay = name, bot_id, delay
end
def speak
loop { sleep delay; puts post }
end
@jonallured
jonallured / economist_enclosures.rb
Created November 25, 2013 00:06
Ensure that the `enclosure_url` is curl-able and not escaping the ampersand.
require 'feedzirra'
feed = Feedzirra::Feed.fetch_and_parse('http://www.economist.com/media/rss/economist.xml')
entries = feed.entries
curls = entries.map do |entry|
curl = `curl --head #{entry.enclosure_url}`
curl.split(/\r/).first
end
@jonallured
jonallured / since13.txt
Created November 13, 2013 03:07
Feedzirra commits between 1.3 and 2.1
aac5657 Bump version for rubygems release
7184331 Merge pull request #183 from AutoUncle/nokogiri-update
0bcaa91 sax-machine 0.2.1 dependency
9b0bd4d Updated Nokogiri to 1.6.0 - temporary hack of sax-machine dependency necessary
87b1bb1 removed git reference
d8a5823 bumping nokogiri version
80cd357 Merge pull request #117 from compressed/upstream
1e37df0 Merge pull request #122 from muffinista/master
c166e0f Merge feed order from #126 [close #126]
d30c412 Merge branch 'ezkl-itunes-parser'
@jonallured
jonallured / converter_spec.rb
Created October 11, 2013 14:38
Calc converter
class Converter
def initialize(input)
@input = input
end
def convert
"3 + 2"
end
end
@jonallured
jonallured / no-turbo.rb
Created May 5, 2013 13:14
Template code to remove turbolinks from a new Rails 4 app.
# This is just a few sed commands to pull out turbolinks if you don't want them.
# To use it, just pass this as the template to your rails new command, like this:
# $ rails new myapp -m /path/to/no-turbo.rb
run "sed '/turbo/d' < Gemfile > Gemfile.tmp && mv Gemfile.tmp Gemfile"
run "sed '/turbo/d' < app/assets/javascripts/application.js > app/assets/javascripts/application.tmp && mv app/assets/javascripts/application.tmp app/assets/javascripts/application.js"
run "sed 's/, \"data-turbolinks-track\" => true//' < app/views/layouts/application.html.erb > app/views/layouts/application.html.tmp && mv app/views/layouts/application.html.tmp app/views/layouts/application.html.erb"