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
>> ActiveSupport::JSON.decode(ActiveSupport::JSON.encode("<groups>")) | |
=> "\\u003Cgroups\\u003E" | |
>> JSON.parse(JSON.dump({:foo => '<groups>'})) | |
=> {"foo"=>"<groups>"} |
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
Ruby C | |
crc = ceffffff crc = ceffffff | |
crc = 993ee24a crc = 993ee249 | |
crc = 36bcd924 crc = 36bcd925 | |
crc = 6d79b248 crc = 6d79b24a | |
crc = daf36490 crc = daf36494 | |
crc = b127d498 crc = b127d49f | |
crc = 668eb488 crc = 668eb489 | |
crc = cd1d6910 crc = cd1d6912 | |
crc = 9efbcf98 crc = 9efbcf93 |
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
fish+rvm | |
======== | |
Since rvm is a large collection of bash scripts and fish is not bash-compatible, | |
users of fish need a wrapper around rvm to make it work properly with that shell. | |
Since rvm just manipulates environment variables, we just need a way to preserve | |
those changes. | |
Install | |
------- |
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
# ruby -rdebug_proxy -e "DebugProxy.new('foo', :string).gsub!(/o/, 'a')" | |
# | |
# DebugProxy (string) ------------------------- | |
# | | | |
# | Method called on proxy object: | | |
# | gsub!(/o/, "a") | | |
# | | | |
# | Stack trace of method call: | | |
# | -e:1 | | |
# | | |
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 Command | |
attr_accessor :command, :stdout, :stderr, :process | |
class Error < RuntimeError | |
def initialize(command) | |
error = "command failed" | |
error << " ($?=#{command.process.exitstatus})" if command.process | |
error << ": #{command.command_string}" | |
error << "\n\nOUTPUT:\n\n#{command.stdout}" if command.stdout && !command.stdout.empty? |
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 'fileutils' | |
module Helpers | |
def capture(*cmd) | |
Command.capture(*cmd) | |
end | |
def system_or_die(*cmd) | |
Command.system_or_raise(*cmd) | |
rescue => e |
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
import sys | |
from pygments import highlight | |
from pygments.lexer import RegexLexer, bygroups, include | |
from pygments.token import * | |
from pygments.formatters import * | |
class FishLexer(RegexLexer): | |
name = 'Fish' | |
aliases = 'fish' | |
filenames = ['*.fish'] |
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
function mcd --description 'make and cd to a directory' | |
mkdir -p $argv | |
cd $argv | |
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
donovan ~ $ rbx | |
>> require 'iconv' | |
FFI::NotFoundError: Unable to find 'iconv_open' | |
from FFI::Library(Class)#attach_function at kernel/platform/library.rb:98 | |
from Iconv.__class_init__ (Iconv) at /usr/local/rubinius/1.0.1/lib/iconv.rb:11 | |
from main.__script__ at /usr/local/rubinius/1.0.1/lib/iconv.rb:4 | |
from Rubinius::CodeLoader.require at kernel/common/codeloader.rb:145 | |
from Kernel(Object)#require at kernel/common/kernel.rb:693 | |
from Object#irb_binding {} at (irb):1 |
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
[2010-07-07 07:30:41] tar zxf /home/vadmin/.rvm/archives/zlib-1.2.5.tar.gz -C /home/vadmin/.rvm/src | |
gzip: stdin: invalid compressed data--crc error | |
tar: Child returned status 1 | |
tar: Exiting with failure status due to previous errors | |
[2010-07-07 07:31:09] tar zxf /home/vadmin/.rvm/archives/zlib-1.2.5.tar.gz -C /home/vadmin/.rvm/src | |
gzip: stdin: invalid compressed data--crc error | |
tar: Child returned status 1 | |
tar: Exiting with failure status due to previous errors |