This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'date' | |
require 'benchmark' | |
n = 1_000_000 | |
start_date = Date.new(2012, 01, 01) | |
end_date = Date.new(2012, 03, 01) | |
act_date = Date.new(2012, 02, 01) | |
Benchmark.bm(10) do |x| | |
x.report('include?') do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// gcc -shared -fPIC -o liboverride_strcmp.so -ldl override_strcmp.c | |
// LD_PRELOAD=$PWD/liboverride_strcmp.so <command> | |
#define _GNU_SOURCE 1 | |
#include <stdio.h> | |
#include <string.h> | |
#include <dlfcn.h> | |
#define MAGIC "MAGIC" | |
int strcmp(const char *s1, const char *s2) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sys/types.h> | |
#include <sys/socket.h> | |
#include <sys/un.h> | |
#include <strings.h> | |
#include <errno.h> | |
#include <ctype.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <unistd.h> | |
#define BUFSIZE 4096 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$gutter-width: 30px !default; | |
$grid-width: 978px !default; | |
$columns: 12 !default; | |
$column-width: ($grid-width + $gutter-width) / $columns - $gutter-width; | |
@mixin container { | |
margin-left: auto; | |
margin-right: auto; | |
width: $grid-width; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UsersController < ApplicationController | |
extend ActiveSupport::Memoizable | |
... | |
def index | |
@@index_columns ||= ['username', 'email', 'comments'] | |
@users = User.scoped | |
if params[:_search] == "true" | |
@@index_columns.each do |param| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rvm_gemset_create_on_use_flag=1 | |
rvm use 1.9.2@APPNAME > /dev/null | |
alias god='god -p APPNAME' | |
# put the following line to your ~/.rvmrc if you want to have alias setting here: | |
# unalias god 2>/dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Array | |
def html_safe_join(separator) | |
acc = self.shift | |
acc = acc.try(:html_safe) || acc | |
self.inject(acc) do |a, elem| | |
a << separator | |
a << elem | |
end | |
acc | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setopt prompt_subst | |
chpwd_functions=('__set_current_git_branch' ${chpwd_functions:#__set_current_git_branch}) | |
preexec_functions=('__force_update_git_vars' ${precmd_functions:#__force_update_git_vars}) | |
precmd_functions=('__update_git_vars' ${precmd_functions:#__update_git_vars}) | |
function __force_update_git_vars() { | |
case "$1" in | |
*git*) | |
# delay setting prompt until next precmd hook |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ike:~>>% ruby -e 'puts $".grep(/rubygems/)' | |
/Users/js/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/rubygems.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
multiuser on | |
aclchg * +rwx "#?" | |
chdir /path/of/rails/project | |
screen -t editor vim | |
screen -t tests | |
screen -t database script/dbconsole | |
screen -t log tail -F log/development.log | |
screen -t server script/server | |
caption always "%H%=%-Lw%{R.}%n%f*%{-} %t%+Lw%=%c:%s" | |
hardstatus alwayslastline "%n %t%? - %h" |
NewerOlder