Skip to content

Instantly share code, notes, and snippets.

View brettchalupa's full-sized avatar

Brett Chalupa brettchalupa

View GitHub Profile
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active April 3, 2026 16:33
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@brettchalupa
brettchalupa / favorite_sort.rb
Created September 19, 2012 22:18
Sorting and displaying Submissions and their Favorite count
@submissions = Submission.all.sort_by { |s| s.favorites.count }
File.open("favorites_list.txt", "w") do |file|
@submissions.each do |submission|
file << submission.name + " - Favorites: " + submission.favorites.count.to_s + "\n"
end
end
@zoomix
zoomix / agnoster-light.zsh-theme
Created October 3, 2012 14:39
agnoster zsh light theme
# vim:ft=zsh ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://gist.github.com/1595572).
#
$ ->
$("div.contacts form").live "ajax:success", ->
$.get window.pathname, (data) =>
$(this).closest("div.contacts").replaceWith $(data).find("div.contacts")

Zero downtime deploys with unicorn + nginx + runit + rvm + chef

Below are the actual files we use in one of our latest production applications at Agora Games to achieve zero downtime deploys with unicorn. You've probably already read the GitHub blog post on Unicorn and would like to try zero downtime deploys for your application. I hope these files and notes help. I am happy to update these files or these notes if there are comments/questions. YMMV (of course).

Other application notes:

  • Our application uses MongoDB, so we don't have database migrations to worry about as with MySQL or postgresql. That does not mean that we won't have to worry about issues with the database with indexes being built in MongoDB or what have you.
  • We use capistrano for deployment.

Salient points for each file:

@cobyism
cobyism / gh-pages-deploy.md
Last active March 24, 2026 04:52
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@brettchalupa
brettchalupa / developer_resources.md
Last active December 12, 2015 09:19
a list of resources for web application and web site developers. for front-end, back-end and everything in-between.
@brettchalupa
brettchalupa / .vimrc
Last active December 14, 2015 04:49
vim config vimrc
execute pathogen#infect()
syntax enable
set hidden
set t_Co=256 " enable 256 color support
set textwidth=80 " set the textwidth char to wrap at
set ts=2 " set the tab spacing to be 2 chars
set shiftwidth=2 " set the shiftwidth to be 2 chars
set wrapmargin=0
set number " display line numbers
set expandtab
@ktheory
ktheory / Gemfile
Last active December 14, 2015 12:38
Rack::Attack heroku demo w/ Redis
source 'https://rubygems.org'
gem 'rack-attack', :ref => '1c01e6097ce18f486d887ebbeb9f0c4b434cd8f5', :git => 'https://github.com/kickstarter/rack-attack.git'
gem 'redis-activesupport'