Skip to content

Instantly share code, notes, and snippets.

@bsaf
bsaf / guybrush.txt
Created May 11, 2012 13:15
Guybrush's lines from The Secret of Monkey Island
# extracted from http://www.gamefaqs.com/pc/562681-the-secret-of-monkey-island/faqs/23891
Hi! My name's Guybrush Threepwood, and I want to be a pirate!
Er... I'm over this way.
THREEPWOOD. Guybrush THREEPWOOD.
Gosh, thanks! I'll do that! Bye, now. I'm off to seek my fortune.
(walks away, but suddenly stops)
Right. Thanks.
My name's Guybrush Threepwood. I'm new in town.
I don't know... I kind of like 'Guybrush.'
@jimmyeisenhauer
jimmyeisenhauer / gist:2795771
Created May 27, 2012 00:58
Drop and Rebuild Heroku database
heroku pg:reset SHARED_DATABASE --confirm fasterfaster
heroku run rake db:migrate
heroku run console
Rails.cache.clear
heroku restart
- manually add one record to test
- run performance test
@owainlewis
owainlewis / model_to_csv.rb
Created July 2, 2012 17:58
Export Rails model to CSV
# Export Active Record model as a CSV file
#
def self.render_csv active_record_model
CSV.generate do |csv|
csv << active_record_model.column_names
active_record_model.all.each do |m|
values = active_record_model.column_names.map{ |f| m.send f.to_sym }
csv << values
end
end
@sgmurphy
sgmurphy / url_slug.js
Created July 12, 2012 02:05
URL Slugs in Javascript (with UTF-8 and Transliteration Support)
/**
* Create a web friendly URL slug from a string.
*
* Requires XRegExp (http://xregexp.com) with unicode add-ons for UTF-8 support.
*
* Although supported, transliteration is discouraged because
* 1) most web browsers support UTF-8 characters in URLs
* 2) transliteration causes a loss of information
*
* @author Sean Murphy <sean@iamseanmurphy.com>
@wlangstroth
wlangstroth / deploy.rb
Last active September 11, 2021 13:15
Capistrano + Nginx + Unicorn + Sinatra on Ubuntu
require 'bundler/capistrano'
set :application, "net"
set :repository, "git@githost.com:net.git"
set :scm, :git
set :default_environment, {
'PATH' => "$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH"
}
@mysteriouspants
mysteriouspants / 000-README.md
Created November 7, 2012 17:08
HAML vs ERB vs SLIM on JRuby 1.7.0 Showdown!

Section of Introductions

This was all done on a rather nice iMac:

  • Intel Core i7 Sandy-Bridge 4-core chip
  • 12 GB of RAM
  • 1TB Spinning-disk hard drive
  • java version 1.6.0_37, build 1.6.0_37-b06-434-11M3909 "HotSpot" 64-bit VM "mixed mode" (whatever that's supposed to mean)
  • The excellent pre-chewed testing app at
@jdeoliveira
jdeoliveira / gist:4080656
Created November 15, 2012 19:28
Dump/restore a postgres database in binary format for distribution
/Library/PostgreSQL/9.1/bin/pg_dump --host localhost --port 5432 --username <USERNAME> -b -c -E UTF-8 --no-owner --no-privileges --no-tablespaces --clean --schema public -F c -Z 9 -f <BACKUPFILENAME> <DATABASENAME>
/Library/PostgreSQL/9.1/bin/pg_restore --host localhost --port 5432 --username <USERNAME> --dbname <DATABASENAME> --no-owner --no-privileges --no-tablespaces --clean --schema public "<BACKUPFILENAME>"
@markbates
markbates / gist:4240848
Created December 8, 2012 16:06
Getting Started with Rack

If you're writing web applications with Ruby there comes a time when you might need something a lot simpler, or even faster, than Ruby on Rails or the Sinatra micro-framework. Enter Rack.

Rack describes itself as follows:

Rack provides a minimal interface between webservers supporting Ruby and Ruby frameworks.

Before Rack came along Ruby web frameworks all implemented their own interfaces, which made it incredibly difficult to write web servers for them, or to share code between two different frameworks. Now almost all Ruby web frameworks implement Rack, including Rails and Sinatra, meaning that these applications can now behave in a similar fashion to one another.

At it's core Rack provides a great set of tools to allow you to build the most simple web application or interface you can. Rack applications can be written in a single line of code. But we're getting ahead of ourselves a bit.

@ctalkington
ctalkington / Gemfile
Last active May 16, 2023 20:19
Nginx, Sinatra, and Puma.
source :rubygems
gem "puma"
gem "sinatra"
@stas
stas / deploy.rb
Created January 15, 2013 15:34
Mina Deploy Task (Rails + Puma + Delay Job + rbenv)
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rbenv' # for rbenv support. (http://rbenv.org)
# require 'mina/rvm' # for rvm support. (http://rvm.io)
# Basic settings:
# domain - The hostname to SSH to.
# deploy_to - Path to deploy into.
# repository - Git repo to clone from. (needed by mina/git)