This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'net/http' | |
require 'json' | |
require 'nokogiri' | |
require 'open-uri' | |
# Lat long boundaries | |
# | |
# Around the casino | |
#xmin=172.6299226284027 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lib/generators/test_generator/USAGE | |
Description: | |
A minimal rails 3 generator example | |
Example: | |
rails generate NewClass method1 method2 | |
This will create: | |
app/models/new_class.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DEPLOYHOST=ben@awesomehost.co.nz | |
DEPLOYDIR=/var/www | |
# WARNING: The --delete flag will delete anything on the remote end that isn't | |
# on the local end. But you've got backups, right? | |
upload: | |
rsync -vax -e ssh --exclude .git --delete . $(DEPLOYHOST):$(DEPLOYDIR)/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CHORDII := chordii -a | |
pdfs := $(patsubst %.chordpro,%.pdf,$(wildcard *.chordpro)) | |
all: $(pdfs) | |
%.ps : %.chordpro | |
$(CHORDII) $< > $@ | |
%.pdf : %.ps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
autocmd User Rails/app/assets/javascripts/*/*.js | |
\ let b:rails_alternate = substitute( | |
\ substitute(rails#buffer().path(), 'app/assets/', 'spec/', ''), | |
\ '.js', '_spec.js', '') | |
autocmd User Rails/spec/javascripts/*/*_spec.js | |
\ let b:rails_alternate = substitute( | |
\ substitute(rails#buffer().path(), 'spec/', 'app/assets/', ''), | |
\ '_spec.js', '.js', '') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
usage() { | |
cat <<EOT | |
Usage: PAPERTRAIL_API_TOKEN=abc123 $0 directory | |
Save all papertrail archives to outdir. Existing files will not be | |
overwritten if they have the correct filesize. | |
PAPERTRAIL_API_TOKEN can be found under the 'Me -> Profile' in Papertrail, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# RSpec matcher to spec delegations. | |
# | |
# Usage: | |
# | |
# describe Post do | |
# # post.name -> post.author.name | |
# it { should delegate(:name).to(:author) } | |
# | |
# # post.author_name -> post.author.name | |
# it { should delegate(:author_name).to(:author).as(:name) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
import pyfits | |
import argparse | |
parser = argparse.ArgumentParser( | |
description='Add BeSS FITS headers to a file') | |
parser.add_argument('filename', type=str, help='FITS filename') | |
parser.add_argument('--outfile', '-o', type=str, help='Output filename', | |
required=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example integration spec for a Rake task in Rails | |
# | |
# cat <<EOT > lib/tasks/myapp.rake | |
# namespace :myapp do | |
# task :mytask => :environment do | |
# puts "Hello" | |
# end | |
# end | |
# EOT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo -n "3pm Christmas Day in LA in local timezone: " | |
date --date 'TZ="America/Los_Angeles" 2016-12-25T15:00' | |
echo -n "3pm Christmas Day in LA in London: " | |
TZ="Europe/London" date --date 'TZ="America/Los_Angeles" 2016-12-25T15:00' |