Skip to content

Instantly share code, notes, and snippets.

@tmm1
tmm1 / gist:444476
Created June 19, 2010 01:54
basic SSL support for Thin
diff --git a/lib/thin/backends/base.rb b/lib/thin/backends/base.rb
index ee7f3e4..f22c14b 100644
--- a/lib/thin/backends/base.rb
+++ b/lib/thin/backends/base.rb
@@ -27,6 +27,10 @@ module Thin
attr_writer :threaded
def threaded?; @threaded end
+ # Allow using SSL in the backend.
+ attr_writer :ssl, :ssl_options
@adambair
adambair / rstat.rb
Created November 3, 2011 17:08
Print out Git stats on a repo using Ruby
#!/usr/bin/ruby
require 'yaml'
contributions = {}
`git log --shortstat -z`.each("\0") do |commit|
commit.match(/Author: (\w+) /)
author = $1
commit.match(/(\d+) files changed, (\d+) insertions\(\+\), (\d+) deletions\(\-\)/)
@JangoSteve
JangoSteve / cache.rake
Created November 17, 2011 03:32
Automatically cache pages in Rails, put this in /lib/tasks/cache.rake
# See rails source:
# https://github.com/rails/rails/blob/master/actionpack/lib/action_controller/caching/pages.rb
#
# Turn on caching in development, by changing this line to true in config/environments/development.rb:
#
# config.action_controller.perform_caching = true
#
# Then run:
#
# bundle exec rake pages:cache
@doitian
doitian / specs.js.coffee
Created March 12, 2012 19:33
3 ways to test ajax requests or other asynchronouse lib based on jquery deferred
# The second way is recommended, which is flexible, and also work for non jQuery ajax library.
# Setup sinon sandbox
beforeEach ->
@sinon = sinon.sandbox.create()
afterEach ->
@sinon.restore()
@mhagger
mhagger / seconds.csv
Last active December 8, 2015 18:11 — forked from jonmagic/seconds.csv
This is binary data captured from a car stereo and it's companion cd changer. The stereo updates it's screen with the cd track minutes and "seconds". Each row below corresponds to the "seconds". Column 1 is the seconds, 2 is binary, 3 is 2 inverted. The goal is figuring out how to generate the seconds from 0's & 1's without the table below.
seconds message inverted-message
4 110 001
5 00101 11010
6 10100 01011
7 01100 10011
8 11101 00010
9 00011 11100
10 10010 01101
11 0000101 1111010
12 1000100 0111011