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
# If we save a record using ember-data's RESTadapter, and it fails, Rails | |
# returns the validation errors of the model as JSON hash: | |
# | |
# {"errors":{"name":["may not be blank"]}} | |
# | |
# This patches the RESTadapter to add these errors to the invalid record. It | |
# can be removed when the following Pull Request was merged into ember-data: | |
# https://github.com/emberjs/data/pull/376 | |
DS.RESTAdapter.reopen |
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
#!/bin/bash | |
host=$1 | |
if [ -z "$host" ]; then | |
echo "please provide hostname for node to fetch facts from" | |
exit | |
fi | |
file="features/nodes/$host.yaml" |
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
#!/usr/bin/env ruby | |
# Converts PivotalTracker's (PT) export CSV in a CSV kanbanery (KB) accepts to import. | |
# | |
# Features: | |
# * maps PT's states to KB's columns, see $mapper | |
# * story types are converted | |
# | |
# Bugs: | |
# * comments are not imported |
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
When /^I pause|try pry|I pry|I debug$/ do | |
STDERR.puts "Pausing..." | |
if system(%Q~which zenity~) | |
if system(%Q~zenity --question --text="Paused. Want to pry?"~) | |
binding.pry | |
end | |
else | |
# no zenity installed, pry without asking | |
binding.pry | |
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
PPo00011110101010001111111110000001o | |
PPo00011110101010001111111100000011o | |
PPo00011110101010001111111110000011o | |
PPo00011110101010001111111110000000o | |
PPo00011110101010001111111110000000o | |
PPo00011110101010001111111100000000o | |
PPo00011110101010001111111110000010o | |
{"1000"=>"0", "1110"=>"1", "1111"=>"P", "0000"=>"o"} |
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
# in your .js.rjs templates, you can call #decorate on the magic page object | |
# and then use RJS-powered methods from within your Decorator | |
# | |
# page.decorate User.first do |user| | |
# user.blink | |
# end | |
# | |
# class UserDecorator < ApplicationDecorator | |
# def blink | |
# page[ "user_#{model.id}" ].animate 'blink' |
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
Spork.prefork do | |
require "rails/application" | |
# Prevent Devise from loading the User model super early with it's route hacks for Rails 3.1 rc4 | |
# see also: https://github.com/sporkrb/spork/wiki/Spork.trap_method-Jujutsu | |
Spork.trap_method(Rails::Application, :reload_routes!) | |
Spork.trap_method(Rails::Application::RoutesReloader, :reload!) | |
# rest of your prefork here... | |
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
- unless flash.blank? | |
#flash | |
- flash.each do |name, msg| | |
= content_tag :div, msg, :class => "flash #{name} |
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
class Object | |
def eigenclass | |
class << self; self; end | |
end | |
def eigenclass_eval(&block) | |
eigenclass.instance_eval &block | |
end | |
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
current_scheduler = scheduler(:availabilities) | |
def current_scheduler.handle_exception(job, exception) | |
Airbrake.do_the_right_thing(exception, other_params) | |
puts "job #{job.job_id} caught exception '#{exception}' - the Airbrake has been triggered" | |
end | |
class TaskManager | |
# [..] | |
# do you think this may work? (hoptoad_options scope) |