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
## Docker file of shingara/chruby container | |
FROM base | |
MAINTAINER Cyril Mougel "[email protected]" | |
RUN apt-get update | |
RUN apt-get install -q -y wget | |
RUN apt-get install -q -y ca-certificates | |
RUN apt-get install -q -y make |
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
locale: fr | |
pic_square_url: | |
profile_url: | |
sex: | |
facebook_session_key: | |
new_contest_notifications: t | |
winner_notifications: | |
new_referral_notifications: | |
facebook_access_token: | |
account_id: |
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
. ~/.preexec.bash | |
# called before each command and starts stopwatch | |
function preexec () { | |
export PREEXEC_CMD="$BASH_COMMAND" | |
export PREEXEC_TIME=$(date +'%s') | |
} | |
# called after each command, stops stopwatch | |
# and notifies if time elpsed exceeds threshold |
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
def find_file_created_at(base_dir, time_range) | |
Dir["#{base_dir}/**/*"].select { |f| File.file?(f) && time_range.cover?(File.ctime(f)) }.map{|f| [File.ctime(f), f]} | |
end | |
time_range = Time.new(2011,5,5)..Time.new(2011,5,12) | |
files = find_file_created_at('.', time_range);1 | |
require 'fileutils' | |
files.each do |time, file| |
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
div { | |
//background-color: #3f0; | |
} | |
#one { | |
width:100px; | |
height: 100px; | |
background-color: #A2D4F3; | |
} |
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
date_range = Time.new(2011,5,11)..Time.new(2011,5,12) | |
Dir['**/*'].select { |f| File.file?(f) && date_range.cover?(File.ctime(f)) } |
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
module SpecHelper | |
def local_io(in_str) | |
old_stdin, old_stdout = $stdin, $stdout | |
$stdin = StringIO.new(in_str) | |
$stdout = StringIO.new | |
yield | |
$stdout.string | |
ensure | |
$stdin, $stdout = old_stdin, old_stdout | |
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
# This is a test for Gist.io | |
~~~ruby | |
def coco | |
puts 'coco' | |
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
require 'open3' | |
def ruby_run(cmd, stdin_str) | |
bundler_gem = '-r bundler/setup' if Gem.loaded_specs.keys.include?('bundler') | |
libs = '-I ./lib' | |
full_cmd = %{ruby #{libs} #{bundler_gem} ./bin/#{cmd}} | |
stdout_str, stderr_str = ['', ''] | |
exit_code = 0 | |
Open3.popen3(full_cmd) do |stdin, stdout, stderr, wait_thr| | |
stdin.write stdin_str | |
stdin.close |
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
module ::Enumerable | |
def count_by | |
self.inject({}) do |memo, elem| | |
key = yield elem | |
memo[key] ||= 0 | |
memo[key] += 1 | |
memo | |
end | |
end |