Skip to content

Instantly share code, notes, and snippets.

@bryancusatis
bryancusatis / Gemfile
Created August 8, 2012 03:30
Bundle Install issue - fatal: not a git repository
source 'https://rubygems.org'
gem 'rails', '3.2.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
# Gems used only for assets and not required
@bryancusatis
bryancusatis / mongoid-no-rails.rb
Created September 17, 2012 15:17 — forked from adamzaninovich/mongoid-no-rails.rb
Using Mongoid without Rails
require 'mongoid'
Mongoid::Config.instance.from_hash({"database" => "oid"})
class Tweeter
include Mongoid::Document
field :user
embeds_many :tweets
end
@bryancusatis
bryancusatis / spec_helper.rb
Created September 17, 2012 16:25
Mongoid, DBCleaner, RSpec, no rails
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'rspec'
require 'database_cleaner'
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.strategy = :truncation
@bryancusatis
bryancusatis / deploy.rake
Created October 30, 2012 20:58 — forked from njvitto/deploy.rake
Rakefile to deploy and rollback to Heroku in two different environments (staging and production) for the same app
#Deploy and rollback on Heroku in staging and production
task :deploy_staging => ['deploy:set_staging_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
task :deploy_production => ['deploy:set_production_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
namespace :deploy do
PRODUCTION_APP = 'YOUR_PRODUCTION_APP_NAME_ON_HEROKU'
STAGING_APP = 'YOUR_STAGING_APP_NAME_ON_HEROKU'
task :staging_migrations => [:set_staging_app, :push, :off, :migrate, :restart, :on, :tag]
task :staging_rollback => [:set_staging_app, :off, :push_previous, :restart, :on]
@bryancusatis
bryancusatis / git-prune-tags.rb
Created October 31, 2012 18:17 — forked from rlivsey/git-prune-tags.rb
Script to prune any tags which exist locally but not on the remote
#!/usr/bin/env ruby
require 'readline'
def prompt(prompt="> ")
input = nil
prompt += " " unless prompt =~ /\s$/
loop do
input = Readline.readline(prompt)
break if input.length > 0
end
@bryancusatis
bryancusatis / shipit.rake
Created November 9, 2012 19:17 — forked from taktran/shipit.rake
Ship it! rake task. Some details about the rationale here: http://blog.pebblecode.com/post/32263926012/ship-it
# Ship it! rake task
#
# Merge branch (master by default) to deployment branch, and deploy to server.
#
# Prerequisite:
#
# * Declare all deployment branches in `ALL_DEPLOYMENT_BRANCHES`
# * Declare deploy only branches in `DEPLOY_ONLY_BRANCHES` (ie, does not merge master)
# * Modify `Deploy.command` function as necessary
#
// this is a simple log action
function QueueActionLog(message) {
this.message = message || 'QueueActionLog :: got a action for job id(%s)';
this.apply = function(job) {
console.log(util.format(this.message, job.id));
return true;
};
}
@bryancusatis
bryancusatis / us.json
Created March 4, 2013 16:23
us topology.js
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
http {
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:8m max_size=3000m inactive=600m;
proxy_temp_path /var/tmp;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_comp_level 6;
var crypto = require("crypto");
var moment = require("moment")
var s3 = {
generateS3Policy: function (fileName) {
var s3Policy = {
'conditions': [
{'bucket': CONF.s3.bucket},
['starts-with', '$key', 'uploads/' + fileName],
{'acl': 'public-read'},