Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am stengland on github.
  • I am stengland (https://keybase.io/stengland) on keybase.
  • I have a public key ASDoWzn341wwe8jS8AX4-2RyL6_ifINxIR5-HRhuLfjQygo

To claim this, I am signing this object:

#!/usr/bin/env ruby
require 'json'
require 'date'
wunderlist = JSON.parse(File.read ARGV[0])
tasks, lists = wunderlist['data']["tasks"], wunderlist['data']["lists"]
tasks.map! do |task|
due_date = task["due_date"]
@stengland
stengland / geo.html
Last active August 4, 2016 13:04
Easy redirects or geo data using https://freegeoip.net, can be used on google tag manager.
<script>
function geo(data) {
if (data.country_code == 'IE') {
window.location = "/ie" + window.location.search;
} else {
dataLayer.push(data);
}
}
</script>
#!/bin/sh
if [ ! -d $HOME/.aurbuild ]; then
mkdir $HOME/.aurbuild
fi
cd $HOME/.aurbuild
if [ -d $1 ]; then
cd $1
git pull
@stengland
stengland / rerackup
Last active February 29, 2016 12:31
Simple wrapper around rackup that restarts Rack when files change (uses inotify-tools' inotifywait)
#!/bin/sh
trap Terminate SIGINT SIGTERM SIGQUIT SIGKILL
Start () {
echo "Starting rack..."
rackup $@ &
echo $! > /tmp/rerackup.pid
}
Stop () {
@stengland
stengland / wunderlist2todotxt
Last active September 29, 2015 08:47
Convert wunderlist tasks to todo.txt file
#!/usr/bin/env ruby
require 'json'
require 'date'
wunderlist = JSON.parse(File.read ARGV[0])
tasks, lists = wunderlist['data']["tasks"], wunderlist['data']["lists"]
tasks.map! do |task|
due_date = task["due_date"]
setxkbmap -option caps:swapescape
sh ~/.fehbg &
devmon &
exec i3
#EXTM3U
#EXTINF:-1,BBC - Radio 1
http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1_mf_p
#EXTINF:-1,BBC - Radio 2
http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio2_mf_p
#EXTINF:-1,BBC - Radio 3
http://open.live.bbc.co.uk/mediaselector/5/select/version/2.0/mediaset/http-icy-aac-lc-a/format/pls/vpid/bbc_radio_three.pls
#EXTINF:-1,BBC - Radio 4
http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio4fm_mf_p
#EXTINF:-1,BBC - Radio 5 live
# 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)