This file contains hidden or 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
public class Ackermann { | |
public static int ack(int m, int n){ | |
if (m == 0){ | |
return n + 1; | |
} | |
if (n == 0){ | |
return ack(m - 1, 1); | |
} |
This file contains hidden or 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
require 'rubygems' | |
require 'mongo' | |
@conn = Mongo::Connection.new | |
@db = @conn['trails'] | |
@collection = @db['bikeways'] | |
puts @collection.find('properties.FCODE' => 203001).to_a | |
# BOOM |
This file contains hidden or 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
# I have no idea what I'm doing. | |
require 'java' | |
Dir["sigar/*.jar"].each { |jar| require jar } | |
# import sigar class | |
# Must be java 1.7 | |
import_sigar = org.hyperic.sigar | |
sigar = import_sigar.Sigar.new | |
shell = import_sigar.cmd.Shell.new |
This file contains hidden or 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
# For one, it's just nicer to look at. | |
# No more excessive brackets and semi colons | |
## js | |
function foo(bar){ | |
if (bar == 0){ | |
return "zero!"; | |
} else { | |
return "Not zero!"; | |
} |
NewerOlder