Skip to content

Instantly share code, notes, and snippets.

View jsonperl's full-sized avatar

Jason Pearl jsonperl

View GitHub Profile
require "bundler/inline"
gemfile do
source "https://rubygems.org"
gem "activerecord"
gem "sqlite3"
gem "searchkick", git: "https://github.com/ankane/searchkick.git"
end

Keybase proof

I hereby claim:

  • I am jsonperl on github.
  • I am jsonperl (https://keybase.io/jsonperl) on keybase.
  • I have a public key whose fingerprint is 4EB2 EE10 1A03 2977 0669 6325 ADD4 5A30 88DB F45D

To claim this, I am signing this object:

@jsonperl
jsonperl / Gemfile
Last active December 7, 2015 03:15
source "https://rubygems.org"
ruby "1.9.3", engine: "jruby", engine_version: "1.7.23"
gem "celluloid-io"
class CheapDB
def initialize(filename)
@file = "#{filename}.yml"
FileUtils.touch @file
@data = YAML.load_file(@file) || {}
end
def get_or_set(key, &block)
get(key) || set(key, block.call)
@jsonperl
jsonperl / s3_file_deleter.rb
Last active August 29, 2015 13:56
S3 File Deleter, to delete entire buckets, or subsets...
# Use fog to delete all matching files from a bucket, specifically targeting versioned buckets.
#
# Note: you'll want to 'suspend' versioning since deletes would create a ton of
# DeleteMarkers, which you would then have to delete, recursively,
# until the end of time.
#
# Allows for a dry run to see what you're gonna kill before you kill it
class S3FileDeleter
DELETE_BATCH_SIZE = 900
@jsonperl
jsonperl / s3_utils.rb
Created November 28, 2012 17:47
Copy all s3 files from bucket to bucket
require 'aws/s3'
include AWS::S3
class S3Utils
include AWS::S3
def self.connect!
config = YAML.load(File.open("#{RAILS_ROOT}/config/amazon_s3.yml"))[RAILS_ENV]
@jsonperl
jsonperl / Gemfile
Created April 27, 2012 21:37
EM defer
source 'http://rubygems.org'
gem 'eventmachine', ">= 1.0.0.beta"
@jsonperl
jsonperl / gist:1301602
Created October 20, 2011 16:30 — forked from datapimp/gist:1301586
Cakefile for watching src, compiling coffee to lib, handling sass etc
{spawn, exec} = require 'child_process'
option '-p', '--prefix [DIR]', 'set the installation prefix for `cake install`'
async = require "async"
fs = require "fs"
path = require "fs"
_ = require "underscore"
stdout_handler = (data)->
@jsonperl
jsonperl / s3_utils.rb
Created August 18, 2011 18:07
Copy entire s3 bucket
require 'aws/s3'
include AWS::S3
class S3Utils
include AWS::S3
def self.connect!
config = YAML.load(File.open("#{RAILS_ROOT}/config/amazon_s3.yml"))[RAILS_ENV]