Skip to content

Instantly share code, notes, and snippets.

Avatar
🔎
hunting for code to clean up

M. Scott Ford mscottford

🔎
hunting for code to clean up
View GitHub Profile
@mscottford
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
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: http://crashruby.com/2013/06/13/running-changed-tests/
View gist:7761833
rspec `git diff --name-only flux -- spec | egrep '_spec.rb'`
@mscottford
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
# FROM http://blog.jerodsanto.net/2012/12/capybara-and-poltergeist-snap/
def snap!(options={})
path = options.fetch :path, "~/.Trash"
file = options.fetch :file, "#{Time.now.to_i}.png"
full = options.fetch :full, true
path = File.expand_path path
@mscottford
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
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 rsa.pub
sudo mv id_rsa.pub /home/deploy/.ssh/authorized_keys
sudo chmod 600 /home/deploy/.ssh/authorized_keys
View gist:5993305
$ node --version
v0.10.13
$ npm --version
1.3.2
$ lineman --version
0.11.4
$ lineman new test-app
@mscottford
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'
Rake::Task['db:seed'].invoke
end
You can’t perform that action at this time.