Skip to content

Instantly share code, notes, and snippets.

View marcandre's full-sized avatar

Marc-André Lafortune marcandre

View GitHub Profile
@marcandre
marcandre / make.log
Created March 12, 2013 22:07
more /Users/mal/.rvm/log/ruby-2.0.0-p0/make.log
[2013-03-12 18:04:05] make
current path: /Users/mal/.rvm/src/ruby-2.0.0-p0
command(2): make -j2
CC = clang
LD = ld
LDSHARED = clang -dynamiclib
CFLAGS = -O3 -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=shorten-64-to-32 -Werror=implicit-function-declaration -fno-common -pipe
XCFLAGS = -include ruby/config.h -include ruby/missing.h -D_FORTIFY_SOURCE=2 -fstack-protector -fvisibility=hidden -DRUBY_EXPORT
CPPFLAGS = -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libxml2/include -I/usr/local/opt/libxslt/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I. -I.ext/include/x86_64-darwin10.8.0 -I./include -I.
@marcandre
marcandre / log
Created March 12, 2013 22:06
rvm install 2.0.0 --trace
[18:03][/usr/local(master)]$ rvm install 2.0.0 --trace
2.0.0 --trace
rvm 1.18.19 (master) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
+ 1363125790.N /scripts/cli : __rvm_parse_args() 755 > [[ -n '' ]]
+ 1363125790.N /scripts/cli : __rvm_parse_args() 757 > set -o errtrace
+ 1363125790.N /scripts/cli : __rvm_parse_args() 758 > export 'PS4=+ $(date "+%s.%N") ${BASH_SOURCE##${rvm_path:-}} : ${FUNCNAME[0]:+${FUNCNAME[0]}()} ${LINENO} > '
+ 1363125790.N /scripts/cli : __rvm_parse_args() 758 > PS4='+ $(date "+%s.%N") ${BASH_SOURCE##${rvm_path:-}} : ${FUNCNAME[0]:+${FUNCNAME[0]}()} ${LINENO} > '
+ 1363125790.N /scripts/cli : __rvm_parse_args() 790 > [[ -z install ]]
# Change:
ruby_version_is '' ... '1.9' do
it "raises a TypeError on a frozen array" do
lambda { ArraySpecs.frozen_array << 5 }.should raise_error(TypeError)
end
end
ruby_version_is '1.9' do
it "raises a RuntimeError on a frozen array" do
@marcandre
marcandre / caller_locations_benchmark.rb
Last active December 14, 2015 06:19
benchmarking the new `caller_locations` against `caller`
require 'fruity'
def whoze_there_using_caller
caller[0][/`([^']*)'/, 1]
end
def whoze_there_using_locations
caller_locations(1,1)[0].label
end
$ rvm install rbx --debug
rbx - install
Searching for binary rubies, this might take some time.
Remote file does not exist https://rvm.io/binaries/osx/10.6/i386/rbx-head.tar.bz2
Remote file does not exist http://jruby.org.s3.amazonaws.com/downloads/rbx-head.tar.bz2
Remote file does not exist http://binaries.rubini.us/osx/10.6/i386/rbx-head.tar.bz2
rvm_remote_server_url3 not found
No remote file name found
No binary rubies available for: osx/10.6/i386/rbx-head.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.
# Quick and dirty script to compare builtin methods between two rubyies
# Usage:
#
# ruby_old digest.rb | ruby_new digest.rb
def class_signature(klass)
Hash[
{instance: klass, singleton: klass.singleton_class}.to_a
.product([:private, :public, :protected])
.map{ |(level, obj), access| ["#{access} #{level} methods", obj.send("#{access}_instance_methods", false)] }
@marcandre
marcandre / billion.rb
Created February 20, 2013 15:49
Google billion'th letter
# We deal with the problem by writing classes of numbers in tree form.
# Leaves can be a specific number (Centile), a generic centile (GenericValue) or a subtree (another GenericNumber).
# Each such GenericNumber can be expanded one level by replacing the leftmost GenericValue by specific values.
# This is done using GenericNumber.each; the other important method is children, which calculates recursively
# information about all the children: sum, size of strings, number.
# All language dependent constants:
TO_TWENTY = { 0 => '', 1 => 'one', 2 => 'two', 3 => 'three', 4 => 'four',
5 => 'five', 6 => 'six', 7 => 'seven', 8 => 'eight', 9 => 'nine',
10 => 'ten', 11 => 'eleven', 12 => 'twelve', 13 => 'thirteen', 14 => 'fourteen',
@marcandre
marcandre / gist:3498506
Created August 28, 2012 14:30
git completion
#!bash
#
# bash/zsh completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
@marcandre
marcandre / gist:3498470
Created August 28, 2012 14:25
bash config for git
# Prompt
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
function proml {
local BLUE="\[\033[0;34m\]"
local RED="\[\033[0;31m\]"
local LIGHT_RED="\[\033[1;31m\]"
local GREEN="\[\033[0;32m\]"
@marcandre
marcandre / gist:3422303
Created August 22, 2012 04:39
Fixx buzz battle
# Hi # Hi
# For this interview, we'd like you to
# Write fizz buzz
# Ok:
def go
fizzy = ->(n){ n % 3 == 0 }
buzzy = ->(n){ n % 5 == 0 }
fizzbuzzy = ->(n){ n % 15 == 0 }