Skip to content

Instantly share code, notes, and snippets.

@nlindley
nlindley / git-rmu
Created July 16, 2014 23:52
Script to remove untracked files in a git repository.
#!/bin/bash
git status -su | cut -d' ' -f2- | tr '\n' '\0' | xargs -0 rm
@nlindley
nlindley / Capybara Cheat Sheet.md
Last active August 29, 2015 14:05
A Markdown version of the Capybara cheat from https://gist.github.com/zhengjia/428105

Capybara Cheat Sheet

Navigating

visit('/projects')
visit(post_comments_path(post))

Clicking links and buttons

Foreman Setup

Install Homebrew

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install rbenv and ruby-build

'.source.js':
'BDD Test Case':
'prefix': 'gwt'
'body': """
describe('Given $1', function() {
describe('When $2', function() {
it('Then $3', function(done) {
$4
done();
});

joi Logo

Object schema description language and validator for JavaScript objects.

Current version: 4.7.x

Build Status

Lead Maintainer: Eran Hammer

@nlindley
nlindley / launch_rails_app.applescript
Created August 22, 2012 18:45
Quick and dirty AppleScript to set up my terminal windows the way I like for a Rails project.
tell application "Finder"
set FolderPath to (choose folder default location alias ((home as text) & "RailsApps"))
set PosixPath to POSIX path of FolderPath
end tell
tell application "Terminal"
activate
module Jekyll
class ArchiveGenerator < Generator
safe true
def generate(site)
collate_by_month(site.posts).each do |month, posts|
page = ArchivePage.new(site, month, posts)
site.pages << page
end
end
@nlindley
nlindley / titleize-filename-for-heading.sh
Last active December 22, 2015 22:59
Silly one-liner that lists directory contents (for my use-case, they were only regular files), strips the extension, titleizes the filename, and prepends that as a Markdown heading.
for FILENAME in `ls`; do perl -pi -e "print \"# `ruby -e \"require 'active_support/inflector'; puts '${FILENAME%.md}'.titleize\"`\n\n\" if $. == 1" $FILENAME; done;
@nlindley
nlindley / swap.sh
Created September 13, 2013 21:36
Swaps two files.
#!/bin/sh
if test $# -ne 2
then
echo "Usage: swap <filename> <filename>"
exit 1
fi
if test ! -w "$1"
then
@nlindley
nlindley / archivepage.rb
Last active December 30, 2015 04:18 — forked from ilkka/archivepage.rb
module Jekyll
class ArchivePage < Page
include Convertible
attr_accessor :site, :pager, :name, :ext, :basename, :dir, :data, :content, :output
# Initialize new ArchivePage
# +site+ is the Site
# +month+ is the month
# +posts+ is the list of posts for the month