Skip to content

Instantly share code, notes, and snippets.

View denzuko's full-sized avatar
💬
linkedin.com/in/denzuko

Dwight Spencer denzuko

💬
linkedin.com/in/denzuko
View GitHub Profile
@denzuko
denzuko / gist:2381206
Created April 14, 2012 00:44 — forked from shripadk/gist:652819
Express authentication using Redis for session store and Couchdb for database (in coffeescript!)
###
Module dependencies
###
require.paths.unshift "#{__dirname}/lib/support/express-csrf/"
require.paths.unshift "#{__dirname}/lib/support/node_hash/lib/"
express = require 'express'
app = module.exports = express.createServer()
RedisStore = require 'connect-redis'
@denzuko
denzuko / page_inject.coffee
Created May 8, 2012 01:30 — forked from ntreadway/page_inject.coffee
Simple page inject for JQuery Mobile and Rails Partials
# Used to dynamically add a rails page view when using Jquery Mobile
# Author Nick Treadway @nicktea
window.insert_page = (id, content) ->
page = $("<article id="+id+" data-role='page' data-url="+id+" data-add-back-btn='true'>" + content + "</article>")
page.appendTo('body')
$('a').attr("href", "#" + id).click ->
$.mobile.changePage(page, {transition: "slide"})
@denzuko
denzuko / Procfile
Created June 11, 2012 07:46 — forked from czottmann/Procfile
Example of a Foreman/Capistrano/upstart setup
worker: QUEUE=* bundle exec rake environment resque:work
scheduler: bundle exec rake environment resque:scheduler
@denzuko
denzuko / Gemfile
Created June 15, 2012 01:07 — forked from juhat/Gemfile
Guard & Foreman setup
group :test, :development do
gem 'guard-rspec'
gem 'guard-cucumber'
gem 'libnotify'
gem 'foreman'
end
@denzuko
denzuko / gist:2986054
Created June 25, 2012 02:20 — forked from gerhard/gist:1852864
Deliver vs git-hooks

Why not just use git hooks?

  1. They run in the background, thus there is no visibility as to whether they succeed or fail.

  2. Deploying an app from start to finish involves multiple users, and if done right requires sudo privileges. The system user under which the app runs must not have sudo privileges, but the app itself would use Foreman ideally. If you export to Sys V or Upstart, you will need sudo privileges.

@denzuko
denzuko / two_factor_ssh.rb
Created June 26, 2012 11:50 — forked from moomerman/two_factor_ssh.rb
Two Factor SSH Authentication
#!/usr/bin/env ruby
require 'rubygems'
require 'rotp'
require 'time'
user = ARGV[0]
secret = ARGV[1]
abort unless user and secret
trap("INT") do
@denzuko
denzuko / gist:3201864
Created July 29, 2012 21:14 — forked from anildigital/gist:410309
Awesome unicorn config.
# unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D
rails_env = ENV['RAILS_ENV'] || 'production'
# 16 workers and 1 master
worker_processes (rails_env == 'production' ? 16 : 4)
# Load rails+github.git into the master before forking workers
# for super-fast worker spawn times
preload_app true
@denzuko
denzuko / installation.sh
Created July 30, 2012 00:59 — forked from mikhailov/installation.sh
nginx+passenger (real production config)
# NOTICE: to get Nginx+Unicorn best-practices configuration see the gist https://gist.github.com/3052776
$ sudo apt-get install openssl-dev
$ gem install passenger -v=3.0.12 --no-ri --no-rdoc
$ passenger-install-nginx-module --extra-configure-flags="--with-pcre=/usr/src/pcre-8.30 --with-openssl-opt=no-krb5 --with-http_gzip_static_module --with-http_stub_status_module --without-mail_pop3_module --without-mail_smtp_module --without-mail_imap_module"
@denzuko
denzuko / contact-form.rb
Created August 3, 2012 17:18 — forked from vitobotta/contact-form.rb
A Sinatra-powered contact form for Jekyll
# See blog post at http://vitobotta.com/sinatra-contact-form-jekyll/
%w(rubygems sinatra liquid active_support/secure_random resolv open-uri pony haml).each{ |g| require g }
APP_ROOT = File.join(File.dirname(__FILE__), '..')
set :root, APP_ROOT
set :views, File.join(APP_ROOT, "_layouts")
not_found do
@denzuko
denzuko / ditz.vim
Created August 18, 2012 14:36 — forked from ursm/ditz.vim
function! s:Todo()
call s:OpenBufferFromCommand('ditz todo', function('s:IssueCallback'))
endfunction
function! s:TodoAll()
call s:OpenBufferFromCommand('ditz todo --all', function('s:IssueCallback'))
endfunction
function! s:Grep(args)
call s:OpenBufferFromCommand(printf('ditz grep "%s"', a:args), function('s:IssueCallback'))