Skip to content

Instantly share code, notes, and snippets.

View luislavena's full-sized avatar

Luis Lavena luislavena

View GitHub Profile
C:\Users\Luis\Projects\_sandbox\ruby-perf>ruby -v require_benchmark.rb
ruby 1.8.7 (2011-02-18 patchlevel 334) [i386-mingw32]
user system total real
500 requires 0.078000 0.202000 0.280000 ( 0.283016)
1000 requires 0.187000 0.375000 0.562000 ( 0.575033)
1500 requires 0.265000 0.624000 0.889000 ( 0.900051)
2000 requires 0.515000 0.780000 1.295000 ( 1.292074)
2500 requires 0.686000 1.076000 1.762000 ( 1.773102)
ruby 1.9.2p180 (2011-02-18) [i386-mingw32]
@luislavena
luislavena / gist:954581
Created May 4, 2011 01:12
VS2010 (x64) vs GCC 4.5.1 (x86), GCC 4.5.3 (x86) and GCC 4.5.3 (x64) - Pointless microbenchmarks
# i386-mingw32: RubyInstaller
# x64-mswin64_100: Arton's NougakuDo (http://www.artonx.org/data/nougakudo/index.html)
# x64-mingw32: Experimental 64bits RubyInstaller
ruby 1.8.7 (2011-02-18 patchlevel 334) [i386-mingw32]
time elapsed: 10.772616 sec.
time elapsed: 10.782617 sec.
time elapsed: 10.796617 sec.
time elapsed: 10.754615 sec.
time elapsed: 10.824619 sec.
@luislavena
luislavena / Rakefile
Created May 2, 2011 23:20
Proof of concept on building extensions that links against executable (as shared library) - To implement Rubinius rbx on Windows
require 'rake/clean'
CLEAN.include '*.{a,o,def,exe,so}'
file 'vm.exe' => ['main.c', 'interface.h'] do |t|
cfiles = t.prerequisites.reject { |f| f !~ /\.c$/ }
cfiles.each do |f|
sh "gcc -c #{f} -o #{f.ext('.o')} -DRBX_WINDOWS -DRBX_BUILDING_VM"
end
@rmoriz
rmoriz / Gemfile
Last active September 23, 2024 03:00
UUID primary keys in Rails 3
# Gemfile
gem 'uuidtools'
@fnichol
fnichol / README.md
Created March 12, 2011 20:52
Download a cacert.pem for RailsInstaller

Why?

There is a long standing issue in Ruby where the net/http library by default does not check the validity of an SSL certificate during a TLS handshake. Rather than deal with the underlying problem (a missing certificate authority, a self-signed certificate, etc.) one tends to see bad hacks everywhere. This can lead to problems down the road.

From what I can see the OpenSSL library that Rails Installer delivers has no certificate authorities defined. So, let's go fetch some from the curl website. And since this is for ruby, why don't we download and install the file with a ruby script?

Installation

The Ruby Way! (Fun)

@vertiginous
vertiginous / gist:772895
Created January 10, 2011 15:27
Installing oniguruma on windows with devkit.

NOTE: If you use ansicon make sure it is not loaded

Download the Oniguruma library.

I have had good luck with 5.9.1 and 5.9.2.

Extract it to a temporary folder.

I used C:\Users\gthiesfeld\Work\repo\onig-5.9.2.

!!!
html
head
body
h1#logo {style: "use a stylesheet please"}
< This is inline content
and can be on multiple lines though I'm
not sure why you'd want to do that
p
> This is block content
@luislavena
luislavena / bench_erb_erubis_haml_slim.rb
Created October 16, 2010 21:49
Measure Ruby template engines
require 'benchmark'
require 'erb'
require 'erubis'
#gem 'haml', '3.0.21'
gem 'haml', '3.1.0.alpha.14'
require 'haml'
# 0.6.0 beta automatically escapes html
@dasch
dasch / compl1.rb
Created September 10, 2010 17:59 — forked from antirez/compl1.rb
Redis auto-completion
# compl1.rb - Redis autocomplete example
# download female-names.txt from http://antirez.com/misc/female-names.txt
require 'rubygems'
require 'redis'
r = Redis.new
# Create the completion sorted set
if !r.exists(:compl)
@jonforums
jonforums / dk.rb
Created July 16, 2010 21:21
DevKit install helper script
require 'win32/registry'
require 'yaml'
require 'fileutils'
module DevKitInstaller
DEVKIT_ROOT = File.expand_path(File.dirname(__FILE__))
REG_KEYS = [
'Software\RubyInstaller\MRI',