Skip to content

Instantly share code, notes, and snippets.

require 'fiddle'
require 'fiddle/import'
module GVL
include Fiddle
extend Importer
dlload Handle::DEFAULT
T = import_function 'rb_thread_call_without_gvl', TYPE_VOIDP,
require 'fiddle'
class GVL
handle = Fiddle::Handle::DEFAULT
address = handle['rb_thread_blocking_region']
func = Fiddle::Function.new address, [Fiddle::TYPE_VOIDP,
Fiddle::TYPE_VOIDP,
Fiddle::TYPE_VOIDP,
Fiddle::TYPE_VOIDP], Fiddle::TYPE_VOIDP
#!/usr/bin/env node
/*
* Parsing BIG compressed data with Node.js and SAX
* Probably some bugs, but worked fine for OpenStreetMap Great Britain bz2
* Greg Miell 2012
*/
// Simple string trim prototype extension
String.prototype.trim = function() {
@fritzsche
fritzsche / range.rb
Created May 20, 2012 13:01
How to enable http byte range header
# (c) Thomas Fritzsche
# This is prove-of-concept coding only
# iOS devices insist on support for byte-rage http header, that is not native
# supported by rack apps like dragonfly
# this rack middleware will evaluate the http header and provide byte range support.
# For a dragonfly Rails (3.2.3) app I have tested this will call like this.
# I reload Rack::Cache that case trouble when initialized by Rails.
# This small trick makes it working :-)
#-----------------------
@fritzsche
fritzsche / main.rb
Created May 27, 2011 07:24
Ruby Textile Parser (work in progress)
require "pp"
require "test/unit"
require "cgi"
# (C) Thomas Fritzsche May, 2011
module Parser
class Match
attr_accessor :token,:name,:children