This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
text = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do | |
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim | |
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo | |
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse | |
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non | |
proident, sunt in culpa qui officia deserunt mollit anim id est laborum." | |
freqs = text.downcase.tr(".\n ",'').chars.inject(Hash.new(0)) { |freq,c| | |
freq[c] += 1; freq }.to_a.sort{ |a,b| a.last <=> b.last} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
######################################################################### | |
# # | |
# MySQL performance tuning primer script # | |
# Writen by: Matthew Montgomery <[email protected]> # | |
# Inspired by: MySQLARd (http://gert.sos.be/demo/mysqlar/) # | |
# Version: 1.5-r5 Released: 2009-11-22 # | |
# Licenced under GPLv2 # | |
# # |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# From http://www.algolist.com/code/java/Dijkstra%27s_algorithm | |
# Here you can find the algorithm in Java, C, C++, Python, Ruby and PHP. | |
# | |
# You need pqueue: gem install pqueue | |
# | |
require 'pqueue' | |
class Algorithm | |
INFINITY = 1 << 32 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Configuration | |
class AppServer | |
attr_accessor :port, :admin_password | |
end | |
def initialize | |
@app_server = AppServer.new | |
end | |
attr_accessor :tail_logs, :max_connections, :admin_password, :app_server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# My final solution to 'Closures' exercise at the | |
# Scottish Ruby Conference - Ruby Tutorial | |
# by Chad Fowler and Keavy McMinn. | |
# The returning keyword/proc is not defined in Ruby 1.8. Define it here | |
# | |
def returning(value, &block) | |
yield | |
value | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def returning(value, &block) | |
yield | |
value | |
end | |
def counter(start, inc) | |
lambda do | |
returning start do | |
start += inc | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def counter(start, inc) | |
lambda do | |
current = start | |
start += inc | |
current | |
end | |
end | |
result = counter(10, 2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Getting up and running with OS X, Textmate & Scheme | |
=================================================== | |
SCHEME | |
====== | |
I ran across two implementations of Scheme which appear to work well with OS X. | |
mit-scheme & PLT Scheme. | |
I was able to install mit-scheme from darwin ports ( sudo port install mit-scheme) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> date -d-1day | |
Mon Sep 6 09:08:43 CEST 2010 | |
> date -d-1day +%Y%m | |
201009 |
NewerOlder