Skip to content

Instantly share code, notes, and snippets.

View tfwright's full-sized avatar
🧿

T. Floyd Wright tfwright

🧿
View GitHub Profile
@tfwright
tfwright / tasks.rake
Created December 27, 2009 02:01
A collection of useful rake tasks that doesn't deserve real source control
namespace :db do
desc "Fetches records from the database and prints their attributes"
task :fetch, [:model, :conditions] => :environment do |t, args|
args.with_defaults(:conditions => "id = (SELECT MIN(id) from #{args.model.tableize})")
klass = args.model.classify.constantize
finder = (args.model.pluralize == args.model ? :all : :first)
records = klass.send(finder, :conditions => args.conditions)
puts records.to_yaml
end
With a couple of little commands, you’ll be able to ignore the .DS_Store files forever from your git repositories on mac!
The following command will add the .gitignore file to the git configuration
git config --global core.excludesfile ~/.gitignore
then, the following, will add the .DS_Store to the list
echo .DS_Store >> ~/.gitignore
require 'rake'
require 'yaml'
task :migrate_to_vcr, :resource do |t, args|
resource = args[:resource]
blank_vcr_cassette = YAML.load(File.read "test/vcr_cassettes/blank.yml")
`mkdir test/vcr_cassettes/#{resource}`
responses = Dir["test/fixtures/#{resource}*.txt"]
responses.each do |path|
# Build new cassette
@tfwright
tfwright / rspec_any_instance_test.rb
Created March 26, 2012 21:49
Demonstrates unexpected behavior from .any_instance
require 'rspec/mocks'
describe Object do
it "should play nicely with dup" do
Object.any_instance.stub(:some_method)
o = Object.new
o.some_method
o.dup.some_method
end
@tfwright
tfwright / build_vico.sh
Last active December 28, 2015 01:19 — forked from jmazzi/build_vico.sh
#!/bin/bash
set -ex
rm -rf ~/Code/vico
cd ~/Code
git clone https://github.com/vicoapp/vico.git
cd vico
make app
rm -rf /Applications/Vico.app
mv ~/Code/vico/build/Debug/Vico.app /Applications/Vico.app
@tfwright
tfwright / agent.rb
Created December 3, 2013 20:47 — forked from regedarek/agent.rb
require 'faraday'
require 'forwardable'
module Soup
class Agent
extend Forwardable
def initialize(domain = 'https://www.soup.io/')
@agent ||= faraday(domain)
end
@tfwright
tfwright / -
Created February 18, 2014 20:03
https://github.com/site5/helix_core/pull/1839/files#diff-bfdf6fcde2ee7accbef4ad3294b037b6L32

Keybase proof

I hereby claim:

  • I am tfwright on github.
  • I am tfwright (https://keybase.io/tfwright) on keybase.
  • I have a public key whose fingerprint is 9FD0 0D6E A970 ECFE D432 2BFF D578 3D22 A480 D6A9

To claim this, I am signing this object:

@tfwright
tfwright / discourse
Last active August 29, 2015 14:09 — forked from marcoceppi/discourse
description "Discourse Application"
# automatically start
start on (local-filesystems and net-device-up IFACE!=lo)
chdir /home/discourse/discourse
env RAILS_ENV=production
pre-start exec mkdir -p logs
2016-01-26
2016-01-28
2016-02-02
2016-02-04
2016-02-09
2016-02-11
2016-02-16
2016-02-18
2016-02-23
2016-02-25