Skip to content

Instantly share code, notes, and snippets.

View artob's full-sized avatar
⌨️
Coding

Arto Bendiken artob

⌨️
Coding
View GitHub Profile
I hacked up methodmissing's promise to rename it to ExtPromise. Then I edited the benchmark program like so:
require "benchmark"
require "ext/promise/promise"
require "promise"
TESTS = 1000
Benchmark.bmbm do |results|
# Picked inspect instead of undefined, as the pure-ruby promise will raise an
# exception on undefined instead of return the promise value
ben:promising-future ben$ rake bench; rake1.9 bench; jrake bench
(in /Users/ben/Repos/promising-future)
Rehearsal ----------------------------------------------------------
Nothing 0.000000 0.000000 0.000000 ( 0.004472)
Nothing(Promise) 0.010000 0.000000 0.010000 ( 0.009008)
Nothing(Future) 0.120000 0.050000 0.170000 ( 0.168207)
A method 0.000000 0.000000 0.000000 ( 0.005997)
A method(Promise) 0.010000 0.000000 0.010000 ( 0.012526)
A method(Future) 0.130000 0.040000 0.170000 ( 0.171445)
#== 0.000000 0.000000 0.000000 ( 0.004996)
@artob
artob / grammar.rb
Created August 19, 2010 17:11
Possible syntax for parser combinators in Ruby.
module SXP
module Grammar extend Parallax::Grammar
LPAREN = char('(')
RPAREN = char(')')
INTEGER = term(/^([+-]?\d+)/) { |s| s.to_i }
STRING = term(/^"([^"]+)"/) { |s| s }
SYMBOL = term(/^([\w\d_-]+)/) { |s| s.to_sym }
Atom = INTEGER | STRING | SYMBOL
List = LPAREN << +Atom >> RPAREN
@artob
artob / rspec-lisp.rb
Created August 23, 2010 16:21
Simple Ruby interface for evaluating Common Lisp code, for use with RSpec.
#!/usr/bin/env ruby -rubygems
#
# Simple Ruby interface for evaluating Common Lisp code, for use with RSpec.
# Written in August 2010 by Arto Bendiken <http://ar.to/>
#
# This is free and unencumbered software released into the public domain.
require 'open4' # `sudo gem install open4`
require 'sxp' # `sudo gem install sxp`
@gtzilla
gtzilla / UNLICENSE
Created August 23, 2010 17:07
contents of the Unlicense
UNLICENSE
----
http://unlicense.org/
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
#!/usr/bin/env ruby -rubygems
#
# Simple Ruby interface for evaluating Common Lisp code, for use with RSpec.
# Written in August 2010 by Arto Bendiken <http://ar.to/>
#
# This is free and unencumbered software released into the public domain.
require 'open4' # `sudo gem install open4`
require 'bert'
require 'bert/decode'
@artob
artob / dawg_r2_spec.rb
Created October 17, 2010 12:22
DAWG test suite runner for SPARQL::Grammar::Parser
require File.join(File.dirname(__FILE__), 'spec_helper')
DAWG = RDF::Vocabulary.new('http://www.w3.org/2001/sw/DataAccess/tests/test-dawg#')
MF = RDF::Vocabulary.new('http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#')
QT = RDF::Vocabulary.new('http://www.w3.org/2001/sw/DataAccess/tests/test-query#')
RS = RDF::Vocabulary.new('http://www.w3.org/2001/sw/DataAccess/tests/result-set#')
describe SPARQL::Grammar::Parser do
file = File.expand_path('./spec/dawg-test-suite/data-r2/manifest-syntax.ttl')
url = RDF::URI("file://#{file}")
@bhuga
bhuga / spira
Created October 18, 2010 10:58
first draft. Needs implementation of @setup, @teardown, @query.
#!/usr/bin/env ruby1.9
# local spira bug fix for bnode objects with Types::Any
$:.unshift '~/repos/spira/lib'
require 'spira'
require 'rdf/n3'
require 'rdf/isomorphic'
DAWG = RDF::Vocabulary.new('http://www.w3.org/2001/sw/DataAccess/tests/test-dawg#')
MF = RDF::Vocabulary.new('http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#')
QT = RDF::Vocabulary.new('http://www.w3.org/2001/sw/DataAccess/tests/test-query#')
@narfdotpl
narfdotpl / dnoodles.f
Created October 21, 2010 20:17
Demonic Noodles
* Demonic Noodles
*
* Author: Maciej Konieczny <[email protected]>
* Website: http://gist.github.com/639250
* License: public domain <http://unlicense.org/>
* Background: My first Fortran program; written as a Programming
* Paradigms assignment. We were supposed to generate
* a creature picture in Fortran 77.
/*
filename: basic.css
http://unlicense.org/
author: gregory tomlinson
*/
*{ padding:0; margin:0; }
h1,h2,h3,h4,h5,h6,input,textarea,select,option, body {
font-family:Arial, sans-serif;