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 | |
# encoding: UTF-8 | |
require 'date' | |
since = ARGV.shift || Date.today | |
logs = `git log --since="#{since}" --pretty=format:"%H,%ae,%ai"` | |
all_commits = logs.split("\n").map{|i| i.split(",") } |
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
# config/initializers/sequel.rb | |
module Kaminari | |
module Sequel | |
def self.included(base) | |
base.class_eval do | |
alias :num_pages :page_count | |
alias :limit_value :page_size |
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 "minitest/autorun" | |
# Each member of a Cartesian Array corresponds to the selection of one element each in every one of those sets. | |
# http://en.wikipedia.org/wiki/Cartesian_product | |
class CartesianArray < Array | |
# CartesianArray.new([0,1], [a,b], etc) | |
def initialize(*args) | |
super args |
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 TimeHacks | |
class << Time | |
def now | |
Time.new + offset | |
end | |
def offset | |
@offset ||= 0 |
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 "bigdecimal" | |
def to_percent(c) | |
(c / BigDecimal.new("255.0")).round(3).to_f | |
end | |
color = ARGV.shift.to_s.strip.sub("#", "") |
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 'uri' | |
require 'net/http' | |
class Blog | |
class Connection | |
def request(url, &block) | |
req = Net::HTTP::Get.new(url) | |
req.basic_auth(ENV['blog_user'], ENV['blog_password']) if ENV['blog_user'] |
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 TwilioHelper | |
module TwilioMocker | |
def deliveries | |
@deliveries ||= [] | |
end | |
def create(options) | |
deliveries << options |
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
(function(root, factory) { | |
if (typeof define === 'function' && define.amd) { | |
// AMD | |
define('progressbar', [], function() { | |
return factory(); | |
}); | |
} else { | |
// Browser globals | |
root.ProgressBar = factory(); | |
} |
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
machine: | |
node: | |
version: 0.12.0 | |
dependencies: | |
pre: | |
- export PATH=/usr/local/phantomjs-2.0.0/bin:$PATH | |
- npm config set spin false | |
- npm install -g npm@^2 | |
- npm install -g bower |
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
SELECT *, | |
TO_TSVECTOR(holder_names) || | |
TO_TSVECTOR(first_name) || | |
TO_TSVECTOR(last_name) || | |
TO_TSVECTOR(email) || | |
TO_TSVECTOR(COALESCE(order_token, '')) AS attendee | |
FROM ( | |
SELECT | |
users.id, | |
users.first_name, |