Skip to content

Instantly share code, notes, and snippets.


Ethan Turkeltaub ethnt

View GitHub Profile
sawyerh / blogs_controller.rb
Created June 24, 2016 14:08
Siteleaf on S3 + Rails
View blogs_controller.rb
class BlogsController < ApplicationController
def index
@slug = params[:slug]
.objects[File.join('blog', @slug.to_s, 'index.html')]
unless @file.exists?
puts @file.key
raise'Not Found')
View benchmark
#!/usr/bin/env ruby
$: << File.dirname(__FILE__)+'/lib'
require 'benchmark/ips'
require 'fast_blank'
class String
# active support implementation
def slow_blank?
/\A[[:space:]]*\z/ === self
cannikin /
Last active March 28, 2019 16:08
Typical Ruby on Rails AWS Server Setup

Typical Ruby on Rails AWS Server Setup

You should be able to start a fresh EC2 instance of Ubuntu and follow the instructions below to get a server with your preferred version of Ruby, nginx ready to delegate requests to Unicorn, and logrotate setup to keep your disk from filling up with log files. You will also have ruby-install for installing new rubies and chruby for switching between them. A .ruby-version file will be added to the home directory of the user that runs this script.


  1. Start an EC2 instance using the latest Ubuntu image (as of 2015-06-18 ami-5189a661 for EBS, 64-bit SSD)
  2. Copy the config files below into /tmp using the file names specified in the title.
  3. Edit /tmp/ and change the variables at the top to match your setup
  4. Make /tmp/ executable: chmod +x /tmp/
jodosha / Gemfile
Last active December 9, 2020 15:09
Full stack Lotus application example
View Gemfile
source ''
gem 'rake'
gem 'lotus-router'
gem 'lotus-controller'
gem 'lotus-view'
group :test do
gem 'rspec'
gem 'capybara'
dbreunig /
Last active January 22, 2021 16:07
A description of the data written to the Reporter App Dropbox save folder.

#Reporter Save File Schema

##The Reporter Export File

Reporter saves to your Dropbox account with plaintext JSON files, one for each day. When a Report is entered in the app a file is created for that day if it does not exist. Otherwise, the report is appended to the existing file. The save folder is located in 'Dropbox/Apps/Reporter-App/'.

Reporter save files are named according to the following convention:

xaviershay /
Last active December 24, 2015 20:49
SASS + Coffee + Concatenation in prod
set -exo pipefail
if [ `uname` == 'Darwin' ]; then
JSCOMPRESSOR="yuicompressor --type js"
jbenet /
Last active March 16, 2023 15:34
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

konklone / ssl.rules
Last active August 3, 2022 15:13
nginx TLS / SSL configuration options for
View ssl.rules
# Basically the nginx configuration I use at
# I check it using
# To provide feedback, please tweet at @konklone or email
# Comments on gists don't notify the author.
# Thanks to WubTheCaptain ( for his help and ciphersuites.
# Thanks to Ilya Grigorik ( for constant inspiration.
server {
dirk / state_machine.rb
Last active December 17, 2015 05:38
The only state machine I'll (probably) ever need.
View state_machine.rb
class StateMachine
def initialize
@transitions = {}
def transition(opts, &block)
from = opts[:from]
to = opts[:to]
@transitions[from] ||= {}
@transitions[from][to] = block
inertialbit / ansible-ubuntu-ruby-playbook.yml
Created January 21, 2013 18:10
installs rbenv via rbenv-installer, ruby matching $ruby_version and passenger + apache2 module to $user home and updates $user/.bash_profile w/ rbenv env vars
View ansible-ubuntu-ruby-playbook.yml
- name: install rb-installer
action: shell curl | bash
- name: update PATH in ~/.bash_profile for rb-env
action: lineinfile dest=/home/$user/.bash_profile line=export\ PATH="$HOME/.rbenv/bin:$PATH" regexp=PATH.*rbenv
- name: add rb-env init to ~/.bash_profile
action: lineinfile dest=/home/$user/.bash_profile line='eval "$(rbenv init -)"' regexp=eval.*rbenv