This is a fairly common question, and there isn't a One True Answer.
These are the most common techniques:
Warden::Manager.serialize_into_session{|user| user.id } | |
Warden::Manager.serialize_from_session{|id| User.get(id) } | |
Warden::Manager.before_failure do |env,opts| | |
# Sinatra is very sensitive to the request method | |
# since authentication could fail on any type of method, we need | |
# to set it for the failure app so it is routed to the correct block | |
env['REQUEST_METHOD'] = "POST" | |
end | |
require 'rubygems' | |
require 'rack' | |
class Object | |
def webapp | |
class << self | |
define_method :call do |env| | |
func, *attrs = env['PATH_INFO'].split('/').reject(&:empty?) | |
[200, {}, send(func, *attrs)] | |
end |
# | |
# "<cmd>" <retry times> <retry wait> | |
# | |
do_retry() | |
{ | |
cmd="$1" | |
retry_times=$2 | |
retry_wait=$3 | |
c=0 |
# Ubuntu upstart file at /etc/init/yourservice.conf | |
pre-start script | |
mkdir -p /var/log/yourcompany/ | |
end script | |
respawn | |
respawn limit 15 5 | |
start on runlevel [2345] |
FILE SPACING: | |
# double space a file | |
sed G | |
# double space a file which already has blank lines in it. Output file | |
# should contain no more than one blank line between lines of text. | |
sed '/^$/d;G' |
fix: | |
/usr/libexec/git-core/git-rebase--interactive | |
-git rev-list $merges_option --pretty=oneline --abbrev-commit\ | |
+git rev-list $merges_option --pretty=">%h (%an <%ae>) %s"\ | |
result: | |
1 pick 19f43c1 (Yuri Dyachenko <yurial@gplvote.org>) add: gcrypt::noerr | |
2 pick 990a7e8 (Yuri Dyachenko <yurial@gplvote.org>) add: gcrypt::throwif( err ) throw if err != noerr | |
3 pick cb03f3b (Yuri Dyachenko <yurial@gplvote.org>) add: ext::move<T> move semantic |
--- git-rebase--interactive.old 2011-06-11 13:17:48.000000000 +0400 | |
+++ git-rebase--interactive 2012-04-17 12:44:09.000000000 +0400 | |
@@ -951,7 +951,7 @@ | |
REVISIONS=$ONTO...$HEAD | |
SHORTREVISIONS=$SHORTHEAD | |
fi | |
- git rev-list $MERGES_OPTION --pretty=oneline --abbrev-commit \ | |
+ git rev-list $merges_option --pretty=">%h (%an <%ae>) %s"\ | |
--abbrev=7 --reverse --left-right --topo-order \ | |
$REVISIONS | \ |
L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns
Compress 1K bytes with Zippy ............. 3,000 ns = 3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns = 20 µs
SSD random read ........................ 150,000 ns = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs
class Medium < ActiveRecord::Base | |
serialize :payload, JSON | |
end |