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' | |
require 'grape' | |
module DATA | |
class User | |
attr_accessor :loginname, :email, :person | |
def initialize(attrs) | |
@loginname = attrs[:loginname] | |
@email = attrs[:email] |
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
class Capybara::Session | |
def wait_until(timeout = Capybara.default_wait_time) | |
Timeout.timeout(timeout) do | |
sleep(0.1) until value = yield | |
value | |
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
[2013-06-13 20:40:48 +0000] git push -f git@heroku.com:gravity-production.git FETCH_HEAD:master | |
Warning: Permanently added the RSA host key for IP address '50.19.85.154' to the list of known hosts. | |
-----> Deleting 13 files matching .slugignore patterns. | |
-----> Ruby/Rails app detected | |
-----> Using Ruby version: ruby-1.9.3 | |
-----> Installing dependencies using Bundler version 1.3.2 | |
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment | |
find: `spec': No such file or directory | |
find: `bin': No such file or directory |
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
private List<string> GetSnapshotNames(IEnumerable<VMWareSnapshot> snapshots) | |
{ | |
List<string> result = new List<string>(); | |
foreach (VMWareSnapshot snapshot in snapshots) | |
{ | |
result.Add(snapshot.DisplayName); | |
result.AddRange(GetSnapshotNames(snapshot.ChildSnapshots)); | |
} | |
return result; | |
} |
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
C:\>Svn2Svn.exe /source:c:\source\dni\trunk /destination:c:\Users\dblock\Source\CodePlex\Dni\trunk -r:2:136 -prompt | |
Svn2Svn: 1.0.12089.0 | |
From: c:\source\dni\trunk | |
To: c:\Users\dblock\Source\CodePlex\Dni\trunk | |
Collecting svn log: 2:136 Source SVN root: https://dotnetinstaller.svn.sourceforge.net/svnroot/dotnetinstaller/ | |
Source SVN uri: https://dotnetinstaller.svn.sourceforge.net/svnroot/dotnetinstaller/trunk/ | |
Relative path: /trunk/ | |
......................................................................................................... | |
Collected 105 revisions. | |
Revision 2 (11/27/2006 6:42:51 PM) |
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 ENV['DEBUG_REQUIRE'] | |
require 'benchmark' | |
def require(file) | |
@@first ||= Time.now | |
rc = false | |
ts = Benchmark.measure do | |
rc = super | |
end | |
if ENV['DEBUG_REQUIRE'].to_f < ts.total |
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 Thin | |
class Connection < EventMachine::Connection | |
attr_accessor :init_ts, :data_ts | |
def initialize | |
super | |
@init_ts = Time.now | |
Gravity.metrics.increment 'thin.connection' | |
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 cursor_and_tiebreak_id_from_params(options = {}) | |
cursor, tiebreak_id = nil | |
if params[:cursor] | |
raw_cursor = params[:cursor].split(":")[0...-1].join(":") | |
cursor = (options[:field_type] == String ? raw_cursor : raw_cursor.to_i) | |
tiebreak_id = params[:cursor].split(":")[-1] | |
elsif options[:default_cursor] | |
cursor = (options[:field_type] == String ? options[:default_cursor] : options[:default_cursor].to_i) | |
end | |
[ cursor, tiebreak_id ] |
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
summary_totals = {} | |
summary_totals.default = 0 | |
count = 0 | |
{ | |
Collection => :items, | |
Artwork => :images | |
}.each do |coll, orderable_subcoll| | |
coll.all.each do |item| | |
$stdout.write "." if count % 1000 == 0 | |
count += 1 |
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
# MIT License (c) Artsy Inc. 2013 | |
# Deep Zoom module for generating Deep Zoom (DZI) tiles from a source image | |
# Borrows heavily from https://github.com/meso-unimpressed/deep_zoom_slicer | |
module DeepZoom | |
extend ActiveSupport::Concern | |
# Defaults | |
DEFAULT_TILE_SIZE = 512 |