Skip to content

Instantly share code, notes, and snippets.

(ns tak)
(defn tak [#^Integer x #^Integer y #^Integer z]
(let [x (int x)
y (int y)
z (int z)]
(if (<= x y)
z
(tak (tak (dec x)
y z)
#!/usr/bin/env ruby -w
require 'rubygems'
require 'builder'
builder = Builder::XmlMarkup.new(:target => $stdout, :indent => 2)
builder.instruct! :xml, :version => '1.0', :encoding => "UTF-8"
builder.declare! :DOCTYPE, :plist, :PUBLIC, "-//Apple//DTD PLIST 1.0//EN", "http://www.apple.com/DTDs/PropertyList-1.0.dtd"
(function() {
document.writeln("HTMLElement.prototype = " + HTMLElement.prototype);
var something = document.getElementById('something');
document.writeln("something = " + something);
document.writeln("something.prototype = " + something.prototype);
document.writeln("something.__proto__ = " + something.__proto__);
document.writeln("HTMLElement.prototype === something.__proto__ = " +
(HTMLElement.prototype === something.__proto__));
#!/usr/bin/env ruby
# ProwlScript, to communicate with the Prowl server.
# Copyright 2009 Luke Amdor
# original script at http://prowl.weks.net/static/prowl.pl
#
# This requires running Prowl on your device.
# See the Prowl website <http://prowl.weks.net>
# Usage:
# bin/prowl.rb -u username -p ~/.prowl_password -n "from ruby"
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.keyboard"
end tell
tell application "System Events"
-- If we don't have UI Elements enabled, then nothing is really going to work.
if UI elements enabled then
tell application process "System Preferences"
get properties
namespace :db do
namespace :migrate do
desc "migrate the other database"
task :other_db => :environment do
ActiveRecord::Base.establish_connection("...")
ActiveRecord::Migrator.migrate("db/other_db_migrate")
end
end
end
#!/usr/bin/env ruby -w
require 'rubygems'
require 'builder'
builder = Builder::XmlMarkup.new(:target => $stdout, :indent => 2)
builder.instruct! :xml, :version => '1.0', :encoding => "UTF-8"
builder.declare! :DOCTYPE, :plist, :PUBLIC, "-//Apple//DTD PLIST 1.0//EN", "http://www.apple.com/DTDs/PropertyList-1.0.dtd"
# 8b1a9f6a5e799f573aedf290a8e39054cf495074 add some file I/O tests
---
name: benchmarks/micro-benchmarks/bm_mergesort.rb
parameters:
- 1
ruby_ver: 1.8.7 2009-06-12 174 i686-darwin10.0.0;-O3 -m64 -march=nocona -msse4 -mmmx -w -pipe -fomit-frame-pointer -mmacosx-version-min=10.6 -fno-common -pipe -fno-common ; '--prefix=/usr/local/Cellar/ruby/1.8.7-p174' '--enable-shared' '--disable-pthread' 'CFLAGS=-O3 -m64 -march=nocona -msse4 -mmmx -w -pipe -fomit-frame-pointer -mmacosx-version-min=10.6' 'LDFLAGS=-arch x86_64'
---
name: benchmarks/micro-benchmarks/bm_mergesort.rb
parameter: 1
iterations: 5
# 8b1a9f6a5e799f573aedf290a8e39054cf495074 add some file I/O tests
---
name: benchmarks/micro-benchmarks/bm_mergesort.rb
parameters:
- 1
ruby_ver: 1.8.7 2008-08-11 72 universal-darwin10.0;-arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common ; '--prefix=/usr' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--disable-dependency-tracking' '--enable-pthread' '--enable-shared' '--prefix=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr' '--with-sitedir=/Library/Ruby/Site' 'ac_cv_func_getcontext=no' 'ac_cv_func_setcontext=no' 'CFLAGS=-arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE' 'LDFLAGS=-arch i386 -arch x86_64 '
---
name: benchmarks/micro-benchmarks/bm_mergesort.rb
parameter: 1
iterations: 5
import scala.actors.Futures._
def countdown(n: Int): Unit = if (n > 0) countdown(n-1)
def time(f: => Any) {
val start = System.nanoTime
f
val elapsed = System.nanoTime - start
val elapsedInMillis = elapsed.toDouble / 1000000
format("Elapsed: %f ms\n", elapsedInMillis)