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
var PrototypeExtensions = { | |
data: function(elem, key, val) { | |
var DATA_REGEX = /data-(\w+)/; | |
var ii = 0; | |
var nattr = elem.attributes.length; | |
if (key && val) { | |
elem.setAttribute('data-' + key, val); | |
} | |
else { | |
for (; ii < nattr; ++ii ) { |
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
defmodule Inspector do | |
def inspector(v,s), do: (IO.puts("[#{s}] #{inspect(v)}"); v) | |
def inspector(v), do: (IO.puts("[check] #{inspect(v)}"); v) | |
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
if(d3 && d3.selection && d3.selection.prototype) { | |
d3sp = d3.selection.prototype; | |
/** add extension functions to d3.selection */ | |
/** attrs - set many attrs on a data node given a hash of attributes | |
usage: | |
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 MyProject | |
class S3 | |
def config | |
Rails.application.config.s3_config | |
end | |
def url_for_read(path, opts) | |
expire_date = (Time.zone.now + opts[:expires]).to_i | |
request_string = "GET\n\n\n#{expire_date}\n/#{config[:bucket]}/#{path}" | |
hmac = OpenSSL::HMAC.digest(digest, config[:secret_access_key], request_string) |
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 Capybara | |
class Session | |
def has_flash?(kind, msg) | |
within ".alert-#{kind}" do | |
has_content?(msg) | |
end | |
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
/** | |
add ability to load json fixtures into jasmine | |
**/ | |
var readJsonFixtures = function() { | |
return jasmine.getJsonFixtures().proxyCallTo_('read', arguments); | |
}; | |
var preloadJsonFixtures = function() { | |
jasmine.getJsonFixtures().proxyCallTo_('preload', arguments); |
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_relative "../../spec/support/test_es_server" | |
require_relative "./webmock" | |
TestEsServer.start | |
at_exit do | |
TestEsServer.stop | |
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
# the hot stuff wrapper/presenter | |
class HotStuff | |
def items | |
@items ||= Stuff.hot.limit(5) | |
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
test: | |
override: | |
- bundle exec rspec spec | |
deployment: | |
acceptance: | |
branch: master | |
commands: | |
- ./script/heroku_deploy.sh <ACCEPTANCE_HEROKU_APP>: | |
timeout: 300 |
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 | |
require 'pp' | |
files = {} | |
ctr = 0 | |
print "Searching " | |
Dir.glob(ARGV[0]).each do |f| | |
s = File.stat(f) | |
if s.file? | |
md5 = (`md5 -q #{f}`).chomp |