Steve England stengland

View BBC-Radio.m3u
1 2 3 4 5 6 7 8 9 10
#EXTM3U
#EXTINF:-1,BBC - Radio 1
http://www.bbc.co.uk/radio/listen/live/r1_aaclca.pls
#EXTINF:-1,BBC - Radio 2
http://www.bbc.co.uk/radio/listen/live/r2_aaclca.pls
#EXTINF:-1,BBC - Radio 3
http://www.bbc.co.uk/radio/listen/live/r3_aaclca.pls
#EXTINF:-1,BBC - Radio 4
http://www.bbc.co.uk/radio/listen/live/r4_aaclca.pls
#EXTINF:-1,BBC - Radio 5 live
View angular_form_builder.rb
1 2 3 4 5 6 7 8 9 10
# Adds ng-model attrs to all formatastic inputs
# based on ActiveModel naming conventions
class AngularFormBuilder < Formtastic::FormBuilder
 
# Almost exact dupilicate of the formtastic input method
# but thhe magick is in the extends :) (Line 13)
def input(method, options = {})
method = method.to_sym if method.is_a?(String)
options = options.dup
options[:as] ||= default_input_type(method, options)
View routes.rb
1 2 3 4 5 6 7 8 9
MyApp::Application.routes.draw do
# External urls
scope host: 'www.example.com' do
get 'thing' => 'dev#null', as: :thing
end
end
 
# Use thing_url in your veiws (thing_path would not include the host)
# thing_url => "http://www.example.com/thing"
View mpc
1 2 3 4
#!/bin/sh
#Wrapper for mpc including host
export MPD_HOST=`cat /etc/mpdhost`
/usr/bin/mpc $@
View Fix rxvt-unicode via ssh.md

If tmux fails with the message "open terminal failed: missing or unsuitable terminal: rxvt-unicode-256color".

$ ssh remotemachine mkdir -p .terminfo/r
$ scp /usr/share/terminfo/r/rxvt-unicode* remotemachine:.terminfo/r/
View vcr.rb
1 2 3 4 5 6 7 8 9 10
VCR.configure do |c|
c.register_request_matcher :xml_body do |request_1, request_2|
EquivalentXml.equivalent?(request_1.body, request_2.body)
end
c.ignore_localhost = true
c.cassette_library_dir = Rails.root.join("spec", "support", "vcr_cassettes")
c.hook_into :webmock
c.configure_rspec_metadata!
c.default_cassette_options = { match_requests_on: [:method, :uri, :xml_body] }
# c.debug_logger = File.open("#{Rails.root}/log/vcr.log", 'w')
View music.yml
1 2 3 4 5 6 7 8 9 10
# ~/.tmuxinator/music.yml
 
project_name: Musix
project_root: ~/Music
pre: mopidy -q &> ~/.mopidy.log &
tabs:
- interface: ncmpcpp
- radio: bbcradio
- mixer: alsamixer
- mopodiy: tail -f ~/.mopidy.log
View manager.rb
1 2 3 4 5 6 7 8 9
def months_til_renewal
months = 0
date_to_check = Date.current
while(date_to_check < current_period_ends_at.to_date) do
date_to_check = date_to_check.next_month
months += 1
end
months
end
View README.md

Usage

Normal

person = Person.new('Jo', 'Bloggs')

HumanName.new(person).full_name
> "Joe Bloggs"
View recurly_updater.rb
1 2 3
def temp_password
@temp_password ||= ((0..9).to_a.sample(2) + ('a'..'z').to_a.sample(6)).shuffle.join
end
Something went wrong with that request. Please try again.