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
$ heroku run bash | |
Running `bash` attached to terminal... up, run.6771 | |
~ $ ls -l /dev/stdin | |
lrwxrwxrwx 1 root root 15 2014-08-11 22:31 /dev/stdin -> /proc/self/fd/0 | |
~ $ ls -l /proc/self/fd/0 | |
lrwx------ 1 u51787 51787 64 2014-08-11 22:31 /proc/self/fd/0 -> /dev/pts/1 | |
~ $ id | |
uid=51787(u51787) gid=51787 | |
~ $ echo echo | cat | |
echo |
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 ruby | |
# | |
# Usage: ./offline_pull_requests.rb user/repo | |
# | |
require 'octokit' | |
require 'erb' | |
require 'redcarpet' | |
def filename_for(pull) | |
'%d.html' % pull.number |
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
# 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
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
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
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
# 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
$ git branch -r --merged | | |
awk -F'/' '/^ *origin/{if(!match($0, /(>|master)/)){print $2}}' | | |
xargs git push origin --delete |
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
# Runs assert_difference with a number of conditions and varying difference | |
# counts. | |
# | |
# Call as follows: | |
# | |
# assert_differences([['Model1.count', 2], ['Model2.count', 3]]) | |
# | |
def assert_differences(expression_array, message = nil, &block) | |
b = block.send(:binding) | |
before = expression_array.map { |expr| eval(expr[0], b) } |