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 Promise = require("bluebird"); | |
var Request = require("superagent").Request; | |
/** | |
* @namespace utils | |
* @class Superagent | |
*/ | |
/** |
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 "./cryload/*" | |
require "http" | |
module Cryload | |
class LoadGenerator | |
def initialize(@host, @number) | |
@stats = Stats.new @number | |
ch = generate_request_channel | |
loop do | |
check_log |
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
# Heavily borrowed from ActiveMerchant::Biling::CreditCard | |
# Updated for ActiveModel::Validations | |
class CreditCard | |
include ActiveMerchant::Billing::CreditCardMethods | |
include ActiveModel::Validations | |
include ActiveModel::Validations::Callbacks | |
include ActiveModel::Naming | |
## Attributes |
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 bash | |
# Configuration | |
SERVER='myserver' | |
DEPLOY_TO='/path/to/app' | |
EXCLUDE='*.swp .git/ db/sphinx/ tmp/ log/' | |
DRY_RUN=false | |
DEPLOY_GEM_PATH='/opt/ec/ruby/1.8.7/lib/ruby/gems/1.8' |
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
# in rails application.rb | |
initializer "postgresql.no_default_string_limit" do | |
ActiveSupport.on_load(:active_record) do | |
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::NATIVE_DATABASE_TYPES[:string].delete(:limit) | |
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
# ./config/initializers/asset_precompile_prefix_fix.rb | |
# | |
# So we can deploy at a SubURI, and precompile assets to respect that with: | |
# RAILS_RELATIVE_URL_ROOT=/foo rake assets:precompile | |
# | |
# See: http://stackoverflow.com/questions/7293918/broken-precompiled-assets-in-rails-3-1-when-deploying-to-a-sub-uri | |
# | |
# Confirmed working in Rails 3.1.3 | |
# Future versions of Rails may make this monkey patch unneccesary. (or break | |
# it without making it unneccesary) |
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 OmniLog | |
attr_reader :available | |
def initialize(path) | |
@real = Logger.new(path) | |
@fake = Logger.new("/dev/null") | |
@available = Set.new | |
end | |
def add!(which) |
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
# controller | |
def notify | |
order = Order.capture_payment(request.raw_post) | |
render :nothing => true | |
end | |
# Order model | |
def self.capture_payment(raw_post) |
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 node | |
// this file is stored in a directory of APP_ROOT/script for me, all things are relative to that | |
var APP_ROOT = __dirname+"/../"; | |
// this assumes there is a file stored in APP_ROOT called "config.js" with the following structure: | |
// | |
// module.exports = { | |
// "development: { | |
// "postgresql": "tcp://postgres@localhost/dev-db" |
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
// Get / setter for local storage | |
function store( key, value ){ | |
if( arguments.length > 1 ){ | |
localStorage.setItem( key, JSON.stringify( value ) ) | |
return value | |
} | |
// Simultaneous getting / setting is bad. | |
// It is wasteful to continuously encode & then decompile JSON and never useful. | |
else { |
OlderNewer