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
# Adaptive benchmarking code I copied from the blog of Mauricio Fernandez | |
module Adaptive | |
class Benchmark | |
# The version of the adaptive-benchmark library | |
VERSION = '0.1.0' | |
# Default options | |
REPORT_OPT = {:precision => 0.1, :confidence => 0.95} |
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
# It would be nice if I could temporarily redirect stdout and stderr. | |
require 'mkmf' | |
# stdout redirected within block only | |
$stdout.reopen('/dev/null') do | |
if have_header('foo.h') | |
# Do stuff | |
end | |
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
# extconf.rb | |
require 'mkmf' | |
create_makefile('foo') | |
# foo.h | |
#ifndef __FOO_H_INCLUDED__ | |
#define __FOO_H_INCLUDED__ | |
#include <ruby.h> |
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
djberge:/Users/djberge/Repositories/rubinius [master]>./configure | |
Configuring LLVM... | |
Checking for existing LLVM tree: found! | |
Checking sizeof(long): 4 bytes | |
Checking platform endianness: little endian | |
Checking tr1/hash definition: not found | |
Checking for function 'backtrace': not found. | |
Configured. Run 'rake' to build and run VM tests and rubyspecs |
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
0000c470 s EH_frame1 | |
U __DefaultRuneLocale | |
000009f8 t __Z10weeknumberPK2tmi | |
00000000 a __Z10weeknumberPK2tmi.eh | |
00000a3a t __Z12iso8601wknumPK2tm | |
0000c4b8 s __Z12iso8601wknumPK2tm.eh | |
000001fc T __Z15mktime_extendedP2tmiPi | |
0000c48c S __Z15mktime_extendedP2tmiPi.eh | |
00000bce T __Z17strftime_extendedPcmPKcPK2tmPK8timespeci | |
0000c4e4 S __Z17strftime_extendedPcmPKcPK2tmPK8timespeci.eh |
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
djberge:/Users/djberge/Repositories/rubinius [master]>which gcc | |
/opt/local/bin/gcc | |
djberge:/Users/djberge/Repositories/rubinius [master]>gcc -v | |
Using built-in specs. | |
Target: i386-apple-darwin8.11.1 | |
Configured with: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_apple-gcc42/work/gcc_42-5531/configure --prefix=/opt/local/lib/apple-gcc42 --enable-languages=c,objc --program-suffix=-apple-4.2 | |
Thread model: posix | |
gcc version 4.2.1 (Apple Inc. build 5531) | |
djberge:/Users/djberge/Repositories/rubinius [master]>rake clean |
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
1) | |
An exception occurred during: before :each | |
Exception#backtrace returns nil if no backtrace was set ERROR | |
Errno::EEXIST: File exists - /home/dberger/.gem/rbx/1.8/cache | |
[0;31m Errno.handle at kernel/common/errno.rb:16[0m | |
[0;34m Dir.mkdir at kernel/common/dir.rb:82[0m | |
FileUtils.fu_mkdir at lib/fileutils.rb:243[0m | |
{ } in FileUtils.mkdir_p at lib/fileutils.rb:204[0m | |
[0;34m Array#each at kernel/bootstrap/array.rb:66[0m | |
FileUtils.mkdir_p at lib/fileutils.rb:201[0m |
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
# Make your classes final. Why? Because we can. | |
module Final | |
class Error < RuntimeError; end | |
def self.included(mod) | |
# Prevent subclassing, except implicity subclassing from Object. | |
def mod.inherited(sub) | |
raise Error, "cannot subclass #{self}" unless self == Object | |
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 'uri' | |
s1 = "http://storage.blah.com/auth28173" | |
s2 = "/container/path/to/object" | |
u = URI.parse(s1) | |
puts u + s2 |
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 'ffi' | |
class Foo | |
class << self | |
extend FFI::Library | |
ffi_lib FFI::Library::LIBC | |
private | |
attach_function 'puts', [:string], :int |
OlderNewer