This file contains hidden or 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
[core] | |
pager = less | |
editor = vim | |
[alias] | |
ci = commit -v | |
st = status | |
di = diff | |
co = checkout | |
br = branch | |
l = log --date=local |
This file contains hidden or 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
gem install thrift -- --with-cppflags='-D_FORTIFY_SOURCE=0' |
This file contains hidden or 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
brew tap homebrew/dupes # Thanks Tom | |
brew install apple-gcc42 | |
export CC=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2 | |
export CXX=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/g++-4.2 | |
export CPP=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/cpp-4.2 | |
brew uninstall v8 | |
gem uninstall libv8 |
This file contains hidden or 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
#!/usr/bin/env ruby | |
# A quick and dirty implementation of an HTTP proxy server in Ruby | |
# because I did not want to install anything. | |
# | |
# Copyright (C) 2009 Torsten Becker <[email protected]> | |
require 'socket' | |
require 'uri' | |
This file contains hidden or 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 'rugged' | |
data = File.read('./source.txt').split("\n") | |
dist = data[0].size.times.map {|i| data.map {|n| n[i] } }.flatten | |
date = Date.today - 366 | |
date += 1 until date.wday.zero? |
This file contains hidden or 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
[2013-11-26 23:45:07] __rvm_make | |
__rvm_make () | |
{ | |
\make "$@" || return $? | |
} | |
current path: /Users/doxuanhuy/.rvm/src/ruby-1.9.2-p320 | |
command(3): __rvm_make -j 1 | |
/usr/local/opt/gcc46/bin/gcc-4.6 -O3 -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include -fno-common -pipe -I. -I.ext/include/x86_64-darwin13.0.0 -I./include -I. -DRUBY_EXPORT -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -o main.o -c main.c | |
/usr/local/opt/gcc46/bin/gcc-4.6 -O3 -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include -fno-common -pipe -I. -I.ext/include/x86_64-darwin13.0.0 -I./include -I. -DRUBY_EXPORT -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -o dln.o -c dln.c | |
/usr/local/opt/gcc46/bin/gcc-4.6 -O3 -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include -fno-common -pipe -I. -I.ext/include/x86_64-darwin13.0.0 -I./include -I. -DRUBY_EXPORT -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -o dmydln.o -c dmydln.c |
This file contains hidden or 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 'rubygems' | |
require 'faye' | |
class ServerAuth | |
def incoming(message, callback) | |
do_something if message =~ /^\/meta\/subscribe/ | |
do_other_something if message =~ /^\/meta\/unsubscribe/ | |
callback.call(message) | |
end | |
This file contains hidden or 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 ApplicationController < ActionController:Base | |
before_action :update_online_status | |
def update_online_status | |
now = DateTime.now | |
expire_time = now + 5.minutes | |
current_time_key = "online_users:#{now.minute}" | |
$redis.sadd(current_time_key, current_user.id) | |
$redis.expireat(current_time_key, expire_time) |