- Add this as
config/projections.json
in your Rails app. - Upgrade to the latest copy of pivotalcommon/vim-config by running:
~/.vim/bin/update
<3 <3 Grant for this.
I long for the day of JSON comments.
config/projections.json
in your Rails app.~/.vim/bin/update
<3 <3 Grant for this.
I long for the day of JSON comments.
require 'jruby/profiler' | |
require 'jruby/profiler/callgrind_printer' | |
module CallgrindProfiler | |
def callgrind | |
unless JRuby.runtime.instance_config.is_profiling? | |
STDERR.puts 'Profiling not enabled, re-run with `ruby --profile.api`' | |
return | |
end |
do shell script "xcode-select --install" | |
do shell script "sleep 1" | |
tell application "System Events" | |
tell process "Install Command Line Developer Tools" | |
keystroke return | |
click button "Agree" of window "License Agreement" | |
end tell | |
end tell |
Why did we monkey patch PgSearch::Document? | |
After reseraching potential solutions it was obvious our best course of action was to use Postgresql's built in full text search indexing to accomodate BlueSky's search needs. After coming to this decision we had to make the decision would we rather build our own custom solution, or use one of several gems available. While I'm typically a fan of custom builds when possible, after reviewing some of the source of two gems (pg_search and textacular) it was easy to do a cost benefit analysis and decide that using a gem in this case was the best course of action. | |
Once the decision had been made to use a gem the question of which gem was the next in line. After doing some research pg_search was the winner because of the internationalization and more complex requirements we like the additional flexability and features pg_search provides (many of which are outlined here https://github.com/Casecommons/pg_search#searching-using-different-search-features.) | |
Using pg_search |
class MethodCounter | |
def initialize | |
@signature = ENV.fetch("COUNT_CALLS_TO") | |
@path = @signature.split(/(?:::|#)/) | |
@scope = @signature.include?("#") ? :instance : :class_or_module | |
@count = 0 | |
@wrapping = false | |
@wrapped = false | |
end |
class ActiveRecord::Base | |
# Usage: | |
# | |
# > puts User.first.to_factory_girl | |
# FactoryGirl.define do | |
# factory :user do | |
# ... | |
# end | |
# end | |
# # Usage: FactoryGirl.create(:user, ...) |
namespace :deploy do | |
reset = "\033[0m" | |
success = "\033[32m" # Green | |
failure = "\033[31m" # Bright Red | |
task :completed do | |
puts "#{success}" | |
puts "*" * 40 | |
puts "SUCCESS" | |
puts "*" * 40 |
require "mixlib/log/formatter" | |
module Mixlib | |
module Log | |
class Formatter < Logger::Formatter | |
# Prints a log message as '[time] severity: message' if Chef::Log::Formatter.show_time == true. | |
# Otherwise, doesn't print the time. | |
def call(severity, time, progname, msg) | |
if @@show_time | |
reset = "\033[0m" |
# I never knew that singleton methods defined on a class are callable via subclasses | |
# Apparently when you create a subclass, that subclass's singleton class has | |
# its superclass's singleton class as an ancestor. | |
class Foo | |
@blip = 'foo' | |
def self.foo; @blip;end | |
end |
These two files should help you to import passwords from mac OS X keychains to 1password. | |
Assumptions: | |
1) You have some experience with scripting/are a power-user. These scripts worked for me | |
but they haven't been extensively tested and if they don't work, you're on your own! | |
Please read this whole document before starting this process. If any of it seems | |
incomprehensible/frightening/over your head please do not use these scripts. You will | |
probably do something Very Bad and I wouldn't want that. | |
2) You have ruby 1.9.2 installed on your machine. This comes as standard with Lion, previous | |
versions of OS X may have earlier versions of ruby, which *may* work, but then again, they |