Skip to content

Instantly share code, notes, and snippets.

View luislavena's full-sized avatar

Luis Lavena luislavena

View GitHub Profile
require 'fiddle'
module FFI
module Library
def ffi_lib *libs
libs.each { |lib| Fiddle.dlopen lib }
end
def attach_function name, arg_types, return_type
f = Fiddle::Function.new(
* Shotgun no funciona, toca reiniciar el servidor después de cada cambio en el código.
* No pudimos poner a correr Sinatra bajo Ruby 1.8.6 en Windows (en otros S.O. funciona bien).
* DataMapper moría usualmente debido a problemas por "falta de memoria" (aunque el sistema tuviera recursos suficientes).
* Los usuarios de Windows 7 con RubyInstaller 1.8.7 veían problemas con mkmf al intentar instalar los gems para los adaptadores de bases de datos.
* El tener que mover DLLs (como SQLite3) en los directorios no es precisamente lo que buscas después de decirles que con "gem install [foo]" tendrán la gema Foo funcionando perfectamente.
Me hubiera gustado subir gists de los errores, pero no me siento capaz de decirle primero a un usuario que Ruby y Sinatra son una maravilla y luego tener que pedirles que creen un bug report para algo tan básico como poner a correr un "Hola Mundo".
Me siento frustrado al leer tweets como: http://twitter.com/christianrojas/status/17539066568, había muchos interesados en conocer Sina
@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',
@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)
@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
!!!
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
@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.

@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)

@rmoriz
rmoriz / Gemfile
Last active February 7, 2020 12:30
UUID primary keys in Rails 3
# Gemfile
gem 'uuidtools'
@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