Skip to content

Instantly share code, notes, and snippets.

View jhirn's full-sized avatar

Joseph Hirn jhirn

View GitHub Profile
@jhirn
jhirn / BmodelGenerator.rb
Last active December 18, 2015 16:29
Generator for making a backbone model. Original author @daytonn
class BmodelGenerator < Rails::Generators::NamedBase
source_root File.expand_path('../templates', __FILE__)
argument :url, type: :string, default: 'url-goes-here'
def generate_view
template "model.js.erb", File.join('app', 'assets', 'javascripts', 'models', "#{file_name}.js")
%x{echo //= require models/#{file_name} | pbcopy}
%x{#{ENV['EDITOR']} #{File.join('app', 'assets', 'javascripts', 'application.js')}}
end
(def input-map { "q" "quit"
"tweet" "tweeting"
"dm" "direct messaging"
"help" "helping" })
(defn process_input [input]
(when-let [value (input-map input)]
print value))
#!/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
if Rails.env.development? || Rails.env.test?
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
namespace :spec do
require 'rubygems'
require 'spork'
#GC.disable
Spork.prefork do
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
require 'capybara/rspec'
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
group :interactive do
guard 'spork', :rspec_env => {'RAILS_ENV' => 'test'}, :wait => 50 do
watch('config/application.rb')
watch('config/environment.rb')
watch(%r{^config/environments/.+\.rb$})
watch(%r{^config/initializers/.+\.rb$})
# load libraries
def load_gem(gem_name, gem_require=nil, &block)
gem_require = gem_require || gem_name
begin
if unbundled_require(gem_name, gem_require)
yield if block_given?
end
rescue Exception => e
warn "Couldn't load #{gem_name}: #{e}"
end
@jhirn
jhirn / rspec-mode.patch
Created January 5, 2011 02:40
This patch worked for me.
diff --git a/rspec-mode.el b/rspec-mode.el
index 22caf94..57fe566 100644
--- a/rspec-mode.el
+++ b/rspec-mode.el
@@ -356,7 +356,10 @@
(if rspec-use-rvm
(rvm-activate-corresponding-ruby))
(rspec-register-verify-redo (cons 'rspec-run opts))
- (compile (mapconcat 'identity (list (rspec-runner) (rspec-spec-directory (rspec-project-root)) (rspec-runner-options opts)) " "))
+ (let ((curdir (file-name-as-directory default-directory)))