Skip to content

Instantly share code, notes, and snippets.

View esmarkowski's full-sized avatar

Spencer Markowski esmarkowski

View GitHub Profile
#seed.rb
plant :admin_users
#block syntax
plant :about_us do |seed|
seed.path = "db/seeds/some_folder"
end
@esmarkowski
esmarkowski / Colorized Logger
Created January 24, 2011 21:27
beautiful colorized messages.
module ActiveSupport
class BufferedLogger
module Severity
COLORIZE = 10
end
include Severity
def add(severity, message = nil, progname = nil, &block)
return if @level > severity
message = (message || (block && block.call) || progname).to_s
message = "\e[0;45m#{message}\e[0;0m\n" if severity == 10
# addressable.rb
module Schemata
module Schema
def addressable
apply_schema :street_address_1, String
apply_schema :street_address_2, String
apply_schema :city, String
apply_schema :state, String
apply_schema :zip_code, String
apply_schema :country, String
@esmarkowski
esmarkowski / deploy.rb
Created November 11, 2011 03:02
Multi-Stage Capistrano Config with Gitflow and Tampon
set :keep_releases, 3
set :stages, %w(production staging)
require 'rainbow'
require 'capistrano/ext/multistage'
require 'capistrano/tampon'
require 'bundler/capistrano'
require 'thinking_sphinx/deploy/capistrano'
set :user, 'deploy'
def run_if_present( path )
puts "if [ -d #{path} ]; then #{yield self}; fi"
end
my_pid_file = "/somewhere/secret"
run_if_present my_pid_file do
"ls #{my_pid_file}"
end
git diff --name-status master..feature/distributed_redis | grep -E "^M"
@esmarkowski
esmarkowski / gitlab
Created July 28, 2012 02:23
Launch Gitlab Diff
#!/usr/bin/env sh
function gitlab {
if [ -z "$1" ]
then
echo "compare\nrepo\n"
else
case "$1" in
compare)
gitlab-compare "${@:2}"
@esmarkowski
esmarkowski / logrotate.conf
Created July 28, 2012 21:38
Add this to /etc/logrotate.conf
/home/deploy/missouriwines/shared/log/*.log {
weekly
missingok
rotate 4
compress
delaycompress
notifempty
copytruncate
}
@esmarkowski
esmarkowski / README.md
Last active December 16, 2015 22:29
Locutus Block Size Results

This scatterplot is constructed from adjusting block size, block rows in Locutus.

Locutus was given a 1000x1000 DOM element to parse whose content changed by 25%. 190 tests were performed and each test utilizes 4 web workers to process the diff.

  • Block Size is represented by Color and Y axis.

  • Block Rows (or how many rows of blocks a worker is assigned) is shown by Radius.

  • Duration represents the time each test took to complete and is displayed in seconds.

@esmarkowski
esmarkowski / .rubberband
Created May 30, 2013 03:11
1. Place elastic in bin/elastic and chmod +x 2. Place boot.elastic.rb in config/boot.elastic.rb 3. Place .rubberband in config/.rubberband To run > bin/elastic @rubberband.search("body:goat")
servers:
- host: localhost
port: 9500