Skip to content

Instantly share code, notes, and snippets.

hunting for code to clean up

M. Scott Ford mscottford

hunting for code to clean up
View GitHub Profile
mscottford / gist:8339754
Created Jan 9, 2014
bash syntax for running an audio alert after a string of commands finish (even if one of them fails)
View gist:8339754
{ echo 'one' && echo 'two'; }; say 'yo'
mscottford / gist:7761833
Created Dec 3, 2013
Command to run specs that have changed (according to git; may need to run git add spec first) Source:
View gist:7761833
rspec `git diff --name-only flux -- spec | egrep '_spec.rb'`
mscottford / gist:7029203
Last active Dec 25, 2015
Bulk whitespace cleanup: This trims end of line whitespace and ensures that the file ends in a newline. I need to clean this up into a more succinct script. This is basically just a copy and paste from my terminal.
View gist:7029203
sunstreaker% perl -pi -e 's/ +$//' **/*.rb
sunstreaker% perl -pi -e 's/ +$//' **/*.json
sunstreaker% perl -pi -e 's/ +$//' **/*.js
sunstreaker% perl -pi -e 's/ +$//' **/*.coffee
sunstreaker% perl -pi -e 's/ +$//' **/*.erb
sunstreaker% perl -pi -e 's/ +$//' **/*.sass
sunstreaker% perl -pi -e 's/ +$//' **/*.css
sunstreaker% perl -pi -e 's/ +$//' **/*.haml
sunstreaker% perl -pi -e 's/ +$//' **/*.rabl
sunstreaker% perl -pi -e 's/ +$//' **/*.html
View poltergeist_screenshot_helper.rb
# spec/support/poltergeist_screenshot_helper.rb
module PoltergeistScreenshotHelper
def snap!(options={})
path = options.fetch :path, "~/.Trash"
file = options.fetch :file, "#{}.png"
full = options.fetch :full, true
path = File.expand_path path
mscottford / gist:6190570
Created Aug 9, 2013
ogg to mp3 conversion with ffmpeg
View gist:6190570
find -name "*.ogg" -exec ffmpeg -ab 192k -i {} -map_meta_data 0:0 {}.mp3 \;
mscottford / gist:6041023
Last active Dec 20, 2015
puppet standalone setup commands for fresh ubuntu 12.04 LTS box
View gist:6041023
sudo apt-get update
sudo apt-get install puppet-common
sudo useradd -d /home/deploy -m deploy
sudo passwd deploy
sudo chsh -s /bin/bash deploy
sudo visudo # append `deploy ALL=(ALL) NOPASSWD:ALL`
# copy up
sudo mv /home/deploy/.ssh/authorized_keys
sudo chmod 600 /home/deploy/.ssh/authorized_keys
View gist:5993305
$ node --version
$ npm --version
$ lineman --version
$ lineman new test-app
mscottford / gist:5707976
Last active Dec 18, 2015
Command used to build Ruby 2.0.0-p353 with rbenv, optimization values and readline from homebrew
View gist:5707976
env CFLAGS='-march=corei7-avx -O2 -pipe' RUBY_CONFIGURE_OPTS="--with-readline-dir=`brew --prefix readline`" rbenv install 2.0.0-p353
View seed_test_db_on_spec.rake
require 'rake'
task :spec => :seed_test_db
task :seed_test_db do
ENV["RAILS_ENV"] ||= 'test'
You can’t perform that action at this time.