Skip to content

Instantly share code, notes, and snippets.

@itang
itang / typego.go
Created September 14, 2012 01:30
type go
package main
import "fmt"
type Integer int
type Name string
func main() {
// undertaking type can assign to Typed var, 同 undertaking type -> Typed var
@itang
itang / PrimitiveTypeTest.java
Created September 20, 2012 01:54
获取基本类型的包装类
public class PrimitiveTypeTest {
public static void main(String[] args) {
System.out.println(getPrimitiveWrapperType(int.class));
}
private static Class<?> getPrimitiveWrapperType(Class<?> class1) {
if (class1 == java.lang.Integer.TYPE) { // 不是 class1 == java.lang.Integer.class
return Integer.class;
}
return null;
@itang
itang / yeti
Created September 23, 2012 12:39
yeti launch shell
java -Xmx512M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=384M -jar `dirname $0`/yeti.jar "$@"
@itang
itang / TestDispatch.scala
Created September 28, 2012 09:03
Dispatch example
import dispatch._
val r = Http(url("http://www.ckernel.org/news/patch/2012.html") OK as.String)
r.map { _.split("\n").toList.count(_.contains("huawei"))} () // 7
@itang
itang / Circle.java
Created October 23, 2012 09:55
Circle Model
package demo;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* 圈子成员接口.
*
*/
@itang
itang / clojure.bat
Created November 6, 2012 01:15
Clojure launch shell
@rem clojure launch shell
@echo off
set SCRIPT_DIR=%~dp0
java -noverify -Xmx512M -jar "%SCRIPT_DIR%clojure-1.4.0.jar" %*
@itang
itang / push.sh
Created June 2, 2013 08:21
一键push
#! /bin/sh
git add .
if [ "$1" = "" ]; then
git commit -m "update"
else
git commit -m "$1"
fi
https_proxy=localhost:8087 git push origin master
@itang
itang / test.dart
Created June 27, 2013 06:10
dart short style method
void main() {
print(f0()); // -> sss
print(f1()); // -> null
print(f2()); // -> sss
print(f3()); // -> yyy
var len = "dasada".split("").where((c) => c == 'a').length;
print("LEN:$len"); //-> 3
}
@itang
itang / sbtnew
Last active December 20, 2015 00:49
sbtnew => sbt new project shell
#!/bin/bash
#-----------------------------------------------------------------------------
# Modified By itang
#-----------------------------------------------------------------------------
## Origin info
#------------------------------------------------------------------------------
# Name: sbtmkdirs
# Purpose: Create an SBT project directory structure with a few simple options.
@itang
itang / small_taste_example.go
Created August 11, 2013 13:51
Rust VS Go - A very small taste of what it looks like
package main
import (
"fmt"
"sync"
)
func main() {
nums := []int{0, 1, 2, 3}
noms := []string{"Tim", "Eston", "Aaron", "Ben"}