This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vim: ft=sh:ts=4:sw=4:autoindent: | |
# Author: Avishai Ish-Shalom <avishai@fewbytes.com> | |
# We need to specify GNU sed for OS X, BSDs, etc. | |
if [[ "$(uname -s)" == "Darwin" ]]; then | |
SED=gsed | |
else | |
SED=sed | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ches@lupin]$ brew install pyside | |
Also installing dependencies: qt, apiextractor, generatorrunner, shiboken | |
==> Downloading https://downloads.sourceforge.net/project/machomebrew/Bottles/qt-4.7.3-bottle.tar.gz | |
######################################################################## 100.0% | |
==> Pouring qt-4.7.3.tar.gz | |
==> Caveats | |
We agreed to the Qt opensource license for you. | |
If this is unacceptable you should uninstall. | |
==> Summary | |
/usr/local/Cellar/qt/4.7.3: 2561 files, 292M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This LOOKS pretty straightforward, but it took awhile to sort out issues with | |
# py2cairo and pygobject, so I hope I've saved you some time :-) | |
# | |
# This assumes you already subscribe to a nice clean virtualenvwrapper workflow | |
# -- see https://gist.github.com/771394 if you need advice on getting there. | |
# There are some optional dependencies omitted, so if you're going to be doing | |
# heavy development with these libs, you may want to look into them. | |
# | |
# We go to some configure option pains to avoid polluting the system-level | |
# Python, and `brew link`ing Cairo which is keg-only by default. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# There are a couple minor quirks (see https://github.com/guard/guard/issues/118), | |
# but mostly this is delightfully straightforward: | |
require 'guard' | |
namespace :assets do | |
desc 'Generate CSS from all source LESS files' | |
task :less do | |
Guard.setup | |
Guard::Dsl.evaluate_guardfile(:guardfile => 'Guardfile', :group => ['frontend']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
begin | |
require 'hirb' | |
rescue LoadError | |
# Missing goodies, bummer | |
end | |
if defined? Hirb | |
# Dirty hack to support in-session Hirb.disable/enable | |
Hirb::View.instance_eval do | |
def enable_output_method |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActionMailer::Base.class_eval do | |
def mail_with_prefix(headers={}, &block) | |
unless Rails.env.production? | |
headers[:subject] = "[#{Rails.env.upcase}] " + (headers[:subject] || '') | |
end | |
mail_without_prefix(headers, &block) | |
end | |
alias_method_chain :mail, :prefix | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Brandon Keepers' "click on any element with given text" Capybara selector/Cucumber | |
# step pairing, adapted for Capybara 1.0+. | |
# http://collectiveidea.com/blog/archives/2010/08/03/clicking-any-element-with-cucumber-and-capybara/ | |
Capybara.add_selector(:element) do | |
xpath { |locator| "//*[normalize-space(text())=#{XPath::Expression::StringLiteral.new(locator)}]" } | |
end | |
When 'I click "$locator"' do |locator| | |
msg = "No element found with the content of '#{locator}'" | |
find(:element, locator, :message => msg).click |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby-1.9.2-p290 :001 > require 'pathname' | |
=> true | |
ruby-1.9.2-p290 :002 > p = Pathname.new('/Users/ches') | |
=> #<Pathname:/Users/ches> | |
ruby-1.9.2-p290 :003 > ENV['foobar'] = p + 'src' | |
TypeError: can't convert Pathname into String | |
from (irb):3:in `[]=' | |
from (irb):3 | |
from /Users/ches/.rvm/rubies/ruby-1.9.2-p290/bin/irb:16:in `<main>' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To run after the `key` declaration is added to the above User model | |
User.all.each do |user| | |
nu = user.dup | |
user.unset :username # clear unique index | |
nu.save | |
# Could we re-associate without duping? My attempts resulted in | |
# `dependent: :destroy` getting invoked when the original user is deleted | |
nu.notes << user.notes.clone |