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 Foo | |
INSTANCE = Foo.new(1) | |
def initialize(arg0) | |
@arg0 = arg0 | |
end | |
end | |
# run me in irb, and you will get this error |
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
public class ParseQueryString { | |
public static void main(String[] args) { | |
String queryString = "foo=a&bar=b"; | |
for(String pair : queryString.split("&")) { | |
int index = pair.indexOf('='); | |
// -1 means not found | |
// 0 means at beginnging, e.g '=a' | |
if(index <=0) { | |
continue; | |
} |
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
import java.util.ArrayList; | |
import java.util.HashMap; | |
import java.util.LinkedList; | |
import java.util.List; | |
import java.util.Map; | |
public class Dijkstra { | |
class VectorAndDistance { |
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
import java.util.Iterator; | |
import java.util.LinkedList; | |
public class BinarySearchTree<T extends Comparable<T>> implements Iterable<T> { | |
// tree node | |
class Node { | |
T value; | |
Node leftChild; | |
Node rightChild; |
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | |
"http://www.w3.org/TR/html4/loose.dtd"> | |
<html> | |
<head> | |
<script src="http://code.jquery.com/jquery-latest.js"></script> | |
<script type="text/javascript" src="http://jzaefferer.github.com/jquery-validation/jquery.validate.js"></script> | |
<style type="text/css"> | |
* { font-family: Verdana; font-size: 96%; } | |
label { width: 10em; float: left; } | |
label.error { float: none; color: red; padding-left: .5em; vertical-align: top; } |
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
object Hobbies { | |
def main(args[]: String){ | |
println(List("Scala", "Java", "ACG", "Linux", "etc").mkString(", ")) | |
} | |
} |