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
[08:34:54 reactant (master $% u=)]$ rvm autolibs status | |
--- | |
value: enable | |
number: 4 | |
runner: osx | |
description: Allow RVM to use package manager if found, install missing dependencies, install package manager (only OS X). | |
[08:35:03 reactant (master $% u=)]$ rvm get head | |
######################################################################## 100.0% | |
Downloading RVM from wayneeseguin branch master | |
% Total % Received % Xferd Average Speed Time Time Time Current |
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
[2013-05-20 08:35:51] make | |
current path: /Users/aaronjensen/.rvm/src/ruby-2.0.0-p195 | |
command(2): make -j8 | |
CC = /usr/bin/clang | |
LD = ld | |
LDSHARED = /usr/bin/clang -dynamiclib | |
CFLAGS = -O3 -march=core2 -mfpmath=sse -msse4.2 -msse4.1 -O2 -fno-common -pipe | |
XCFLAGS = -include ruby/config.h -include ruby/missing.h -DRUBY_EXPORT | |
CPPFLAGS = -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libxml2/include -I/usr/local/opt/libxslt/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include -I. -I.ext/include/x86_64-darwin12.3.0 -I./include -I. | |
DLDFLAGS = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libxml2/lib -L/usr/local/opt/libxslt/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -install_name /Users/aaronjensen/.rvm/rubies/ruby-2.0.0-p195/lib/libruby.2.0.0.dylib -current_version 2 |
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
module AllCacheKey | |
extend ActiveSupport::Concern | |
module ClassMethods | |
def cache_key | |
pluck("COUNT(*)", "MAX(updated_at)").flatten.map(&:to_i).join("-") | |
end | |
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
def check_for_leftovers | |
tables = ActiveRecord::Base.connection.select_values("show tables") | |
leftovers = {} | |
tables.each do |table| | |
next if %w(schema_migrations vanity_experiments).include? table | |
count = ActiveRecord::Base.connection.select_value("select count(*) from #{table}") | |
leftovers[table] = count if count > 0 | |
end | |
if leftovers.any? |
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
<!-- Bad --> | |
<div id="externalhtmlobject"><a name="externalhtmlobjectanc"> | |
<script src='https://www.teachingchannel.org/videos/teaching-declaration-of-independence/embed?format=js' type='text/javascript'></script> | |
</a></div> | |
<!-- Good --> | |
<div id="externalhtmlobject"> | |
<script src='https://www.teachingchannel.org/videos/teaching-declaration-of-independence/embed?format=js' type='text/javascript'></script> | |
</div> |
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
:javascript | |
Bugsnag.releaseStage = "#{Rails.env}"; | |
Bugsnag.notifyReleaseStages = ["#{Rails.env}"]; | |
Bugsnag.metaData = #{bugsnag_metadata.to_json}; | |
Bugsnag.metaData['log'] = { log: "" }; | |
Bugsnag.log = function(message) { | |
Bugsnag.metaData['log']['log'] += message + "\n"; | |
} | |
var _onerror = window.onerror; |
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
require 'thread' | |
class RackDrain | |
@@queue = Queue.new | |
def self.start_request | |
self.queue << :request | |
end | |
def self.end_request | |
self.queue.pop |
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
require 'spec_helper' | |
describe Interaction do | |
TestInteraction = Class.new(Interaction) do | |
model :user | |
string :first_name | |
model_fields user: [:first_name] | |
end | |
describe ".model_fields" do |
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
require 'delayed/backend/active_record' | |
module Delayed | |
module Backend | |
module ActiveRecord | |
class Job < ::ActiveRecord::Base | |
def destroy | |
retries = 0 | |
begin | |
super |
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
# https://github.com/garybernhardt/selecta/issues/30 | |
def compute_match_length(choice, query) | |
# Check for exact match | |
return query.length if choice.index(query) | |
query_chars = query.chars | |
# Extract longest possible substring | |
first_index = choice.index(query_chars.first) |