echo 'export NEWRELIC_DISPATCHER=pow' >> ~/.powconfig
echo 'export POW_WORKERS=1' >> ~/.powconfig
Explanation:
http://andre.arko.net/2011/11/12/use-newrelic-rpm-developer-mode-with-pow/
#!/usr/bin/env ruby | |
require 'benchmark' | |
REGEXPS = [ | |
/^no such file to load -- (.+)$/i, | |
/^Missing \w+ (?:file\s*)?([^\s]+.rb)$/i, | |
/^Missing API definition file in (.+)$/i, | |
/^cannot load such file -- (.+)$/i, | |
] |
describe '#game_won?' do | |
winning = [ | |
<<-BOARD | |
.x... | |
ox... | |
oxo.. | |
oxo.. | |
BOARD | |
] | |
# Assuming all the methods called here also return true/false, | |
# use the logical composition operators to create a final result | |
# which can short-circuit if one of the methods fails: | |
def composed_method | |
frobulate_widgets and refrobulate_widgets and confribulate_frobulations | |
end |
pinger = Enumerator.new do |yielder| | |
loop | |
yielder << "PING" | |
end | |
end | |
pinger.each do |ping| | |
puts ping | |
puts "PONG" | |
end |
echo 'export NEWRELIC_DISPATCHER=pow' >> ~/.powconfig
echo 'export POW_WORKERS=1' >> ~/.powconfig
Explanation:
http://andre.arko.net/2011/11/12/use-newrelic-rpm-developer-mode-with-pow/
describe 'POST api/v1/sessions' do | |
def self.request(options) | |
let(:api_response) { | |
send( | |
options[:method].downcase, | |
options[:path], | |
options[:json], | |
) | |
last_response | |
} |
require 'spec_helper' | |
class Parser | |
def parse(string) | |
stack = [] | |
tokens = string.split(' ') | |
tokens.each do |token| | |
if token =~ /\d/ | |
value = token.to_i |
<% | |
require 'cgi' | |
require 'uri' | |
begin | |
uri = URI.parse(ENV["DATABASE_URL"]) | |
rescue URI::InvalidURIError | |
raise "Invalid DATABASE_URL" | |
end |
class RingBuffer | |
def initialize(redis=nil, list_key=nil) | |
@redis = redis | |
end | |
def next | |
JSON(@redis.rpoplpush(@list_key, @list_key))[0] | |
end | |
def add(item) |
require 'awesome_print' | |
# Put this file into your spec/support directory in order to have RSpec automatically report | |
# on the total number of database records created during a run of your test suite. | |
class ActiveRecordInsertCountReport | |
include Singleton | |
def subscribe_to_notifications | |
ActiveSupport::Notifications.subscribe('sql.active_record') do |*args| | |
name, start, ending, transaction_id, payload = args | |
table_name = payload[:sql][/insert into "(.+?)"/i, 1] |