Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

xnnyygn xnnyygn

🎯
Focusing
Block or report user

Report or block xnnyygn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View foo_instance_error.rb
class Foo
INSTANCE = Foo.new(1)
def initialize(arg0)
@arg0 = arg0
end
end
# run me in irb, and you will get this error
@xnnyygn
xnnyygn / ParseQueryString.java
Created Oct 21, 2014
a simple java program to parse query string
View ParseQueryString.java
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;
}
View Dijkstra.java
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 {
@xnnyygn
xnnyygn / BinarySearchTree.java
Created Nov 26, 2013
binary search tree in java
View BinarySearchTree.java
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;
@xnnyygn
xnnyygn / validation-form-select-by-class
Created Aug 22, 2012
Test html for validation two form with same class
View validation-form-select-by-class
<!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; }
@xnnyygn
xnnyygn / hobbies.scala
Created Jun 8, 2012
My first code example to post on posterous
View hobbies.scala
object Hobbies {
def main(args[]: String){
println(List("Scala", "Java", "ACG", "Linux", "etc").mkString(", "))
}
}
You can’t perform that action at this time.