Skip to content

Instantly share code, notes, and snippets.

@l15n
l15n / gist:917120
Created Apr 13, 2011
Using iconv/readline from RVM
View gist:917120
# In $HOME/.rvm/user/db
ruby_configure_flags=--enable-shared --with-readline-dir=$HOME/.rvm/usr --with-iconv-dir=$HOME/.rvm/usr
@l15n
l15n / gist:361852
Created Apr 10, 2010 — forked from wayneeseguin/gist:296055
rails3-beta on mput-heard with rvm gemset
View gist:361852
# This example shows how to setup an environment running Rails 3 beta2 under 1.9.2-head (mput) with a 'rails3' gem set.
∴ rvm update --head
# ((Open a new shell)) or do 'rvm reload'
# If you do not already have the ruby interpreter installed, install it:
∴ rvm install mput-head
# Switch to 1.9.2-head and gemset rails3, create if it doesn't exist.
∴ rvm --create use mput-head@rails3
View ruby-dev summary:39683-39744
=======================================================
39606 [Feature:trunk] Dir instance methods for relative path
=======================================================
[ruby-dev:39606] Nobu suggests having an instance method on Dir for accessing relative paths, with an implementation in the mvm branch. He came up with this idea after reading Akira TANAKA's article on handling temporary files and symlink attacks (http://www.ipa.go.jp/security/fy20/reports/tech1-tg/2_05.html). Example usage:
$ ./ruby -v -e 'p Dir.open("ext"){|d|d.open("extmk.rb"){|f|f.gets}}'
ruby 1.9.1 (2008-12-25 mvm 20976) [i686-linux]
"#! /usr/local/bin/ruby¥n"
$ mkdir tmp
View rvm trace
+ [[ -z '' ]]
+ [[ ! -z '' ]]
+ [[ ! -z '' ]]
+ [[ ! -z '' ]]
+ [[ 4 -gt 0 ]]
+ rvm_token=install
+ shift
+ case "$rvm_token" in
+ rvm_action=install
+ [[ -z install ]]
View yaml_with_quoted_strings.rb
# Set YAML output of String values in hashes to be double quoted
# Only modifies hashes that are about to run to_yaml
require 'yaml'
class Hash
def to_yaml_with_quoted_strings(*args)
class << self
unless method_defined?(:each_with_quoted_strings)
def each_with_quoted_strings
each_with_normal_strings do |k,v|
if String === v && !v.frozen?
View screen.rb
##
# Autotest::Screen is test result notify GNU Screen's statusline.
#
# === screenshots
# * <img src="http://f.hatena.ne.jp/images/fotolife/s/secondlife/20061109/20061109015543.png" />
# * <img src="http://f.hatena.ne.jp/images/fotolife/s/secondlife/20061109/20061109015522.png" />
#
# == SYNOPSIS
# require 'autotest/screen'
# # Autotest::Screen.statusline = '%H %`%-w%{=b bw}%n %t%{-}%+w (your statusline)'
You can’t perform that action at this time.