Skip to content

Instantly share code, notes, and snippets.

View taiki45's full-sized avatar

Taiki Ono taiki45

View GitHub Profile
source .screen/stem4
#!/bin/sh
set -u
set -e
# Example init script, this can be used with nginx, too,
# since nginx and unicorn accept the same signals
# Feel free to change any of the following variables for your app:
APP_ROOT=/home/deploy/public_html/rm/current
PID=$APP_ROOT/tmp/pids/unicorn.pid
ENV=production
@valvallow
valvallow / fold-modified.scm
Created July 21, 2010 04:23
fold, scheme, gauche
;; srfi-1::fold
(use srfi-8) ; receive
(use srfi-1) ; car+cdr
(define (cars+cdrs ls . rest-lists)
(let/cc hop
(let loop ((lists (cons ls rest-lists)))
(if (null? lists)
(values '() '())
@mnutt
mnutt / Instrument Anything in Rails 3.md
Created September 6, 2010 06:50
How to use Rails 3.0's new notification system to inject custom log events

Instrument Anything in Rails 3

With Rails 3.0 released a few weeks ago I've migrated a few apps and I'm constantly finding useful new improvements. One such improvement is the ability to log anything in the same way that Rails internally logs ActiveRecord and ActionView. By default Rails 3 logs look slightly spiffier than those produced by Rails 2.3: (notice the second line has been cleaned up)

Started GET "/" for 127.0.0.1 at Mon Sep 06 01:07:11 -0400 2010
  Processing by HomeController#index as HTML
  User Load (0.2ms)  SELECT `users`.* FROM `users` WHERE (`users`.`id` = 3) LIMIT 1
  CACHE (0.0ms)  SELECT `users`.* FROM `users` WHERE (`users`.`id` = 3) LIMIT 1

Rendered layouts/_nav.html.erb (363.4ms)

@peterhost
peterhost / screen.rb
Created October 27, 2010 19:18
homebrew formula for screen, hacked from macports
require 'formula'
# This duplicates the system "screen", but fixes the ability
# to use vertical splits.
class Screen <Formula
# this tarball contains a quick and dirty fix :
# 1 - included a copy of the ".orig" files required by the 'patch-wrp_vertical_split.patch' :p0 patches,
# in the tarball's root dir
# 2 - copied 'vproc_priv.h' in the root of the tarball (required by 'patch-screen.c' (osX10.5) and
@yoshikaw
yoshikaw / .screenrc
Created November 2, 2010 22:09
my GNU Screen setting at 2010/11/03
#
# .screenrc - GNU screen user configuration file
#
# $Id: .screenrc 190 2010-04-17 07:54:54Z yoshikaw $
#
# @see http://www.informatik.uni-hamburg.de/RZ/software/screen/screen_toc.html
# @see http://www.limy.org/program/screen_command.html
#
# Escape key is C-t, literal is a.
@pfleidi
pfleidi / fiberchat.rb
Created February 19, 2011 18:51
A naive socket chat using select() and ruby fibers
require 'rubygems'
require 'socket'
include Socket::Constants
class ChatServer
def initialize
@reading = Array.new
@writing = Array.new
@clients = Hash.new
@bmarini
bmarini / default.vcl.pl
Created June 30, 2011 18:01
A good varnish config for a Rails app
# https://www.varnish-cache.org/docs/2.1/tutorial/vcl.html
# https://www.varnish-cache.org/trac/wiki/VCLExamples
# Summary
# 1. Varnish will poll the backend at /health_check to make sure it is
# healthy. If the backend goes down, varnish will server stale content
# from the cache for up to 1 hour.
# 2. Varnish will pass X-Forwarded-For headers through to the backend
# 3. Varnish will remove cookies from urls that match static content file
# extensions (jpg, gif, ...)
@sunaot
sunaot / ycon.rb
Created November 18, 2011 11:59
Ruby で Y コンビネータを写経してみた
#! ruby
# coding: utf-8
#
# http://d.hatena.ne.jp/nowokay/20090409#1239268405
require 'expectations'
Expectations do
# boolean
t = (-> x { (-> y {x}) })
@lavallee
lavallee / screen.rb
Created December 2, 2011 17:51
Homebrew Formula for screen 4.0.3 that has vertical split and works on Snow Leopard
require 'formula'
# This duplicates the system "screen", but fixes the ability
# to use vertical splits.
class Screen < Formula
url 'http://ftpmirror.gnu.org/screen/screen-4.0.3.tar.gz'
homepage 'http://www.gnu.org/software/screen'
md5 '8506fd205028a96c741e4037de6e3c42'
version '4.00.03'