Skip to content

Instantly share code, notes, and snippets.

View logging.gv
digraph Java有多少种方式决定Logging的去处 {
graph [ tooltip = "神马轻量级Logging框架都是骗人的" ]
log4j [ tooltip = "我很快,而且支持很多种输出目标哦" ]
slf4j -> "logback, jdk14, ..."
slf4j -> log4j
log4j -> "org.apache.log4j.ConsoleAppender"
log4j -> "org.apache.log4j.FileAppender"
log4j -> "org.apache.log4j.net.SyslogAppender"
log4j -> "org.apache.log4j.net.SocketAppender"
log4j -> "其他Appender..."
View logging.gv.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Atry
Atry / TailCallBenchmark.scala
Created Apr 1, 2013
Benchmark for scala.util.control.TailCalls
View TailCallBenchmark.scala
import org.junit._
class TailCallBenchmark {
import scala.util.continuations._
@Test
def test() {
import scala.util.control.TailCalls._
def unwind(): Unit @cps[TailRec[Unit]] = {
View NativeInMacro.hx
class NativeInMacro
{
@:macro public static function myMacro():haxe.macro.Expr
{
trace(MyEnum.MY_VALUE);
return macro null;
}
public static function main()
{
trace(MyEnum.MY_VALUE);
View ExplicitCommonType.hx
class ExplicitCommonType
{
public static function main()
{
// ExplicitCommonType.hx:6: characters 71-89 : IntHash<Int> should be Hash<Int>
var iterable:Iterable<Int> = Math.random() < 0.5 ? new Hash<Int>() : new IntHash<Int>();
}
}
@Atry
Atry / build.hxml
Created Sep 14, 2013
生成textLayout的Haxe定义,并替换成2.10兼容的语法
View build.hxml
--gen-hx-classes
-swf-lib haxelib-release/textLayout.swf
-swf no-output.swf
--no-output
--macro removeField("flashx.textLayout.conversion.BaseTextLayoutExporter","exportFlowElement",true)
--macro removeField("flashx.textLayout.conversion.BaseTextLayoutExporter","exportContainerFormattedElement",true)
--macro removeField("flashx.textLayout.conversion.BaseTextLayoutExporter","exportListItem",true)
--macro removeField("flashx.textLayout.conversion.BaseTextLayoutExporter","exportParagraphFormattedElement",true)
--macro removeField("flashx.textLayout.conversion.BaseTextLayoutExporter","exportList",true)
--macro removeField("flashx.textLayout.elements.FlowElement","abstract")
View zhihu_25078922.scala
#!/bin/env scala
trait 所有操作 {
protected type 操作符
protected def 创建操作符(操作: (Int, Int) => Int):操作符
final def = 创建操作符(_ + _)
final def = 创建操作符(_ * _)
View jenkins-post-commit.js
var path = WScript.Arguments(0);
var rev = WScript.Arguments(1);
var WshShell = new ActiveXObject("WScript.Shell");
var expectedDir = WshShell.ExpandEnvironmentStrings("%EXPECTED_DIR%");
var svnlook = WshShell.ExpandEnvironmentStrings("%SVNLOOK%");
var jenkinsUrlPrefix = WshShell.ExpandEnvironmentStrings("%JENKINS_URL_PREFIX%");
var dirsChanged = WshShell.Exec(svnlook + " dirs-changed " + path + " -r " + rev).StdOut;
while (!dirsChanged.AtEndOfStream) {
var dir = dirsChanged.ReadLine();
if (dir.match(expectedDir)) {
View Zhihu37118044.scala
object Zhihu37118044 {
def printDeep(vector: IndexedSeq[_]) {
import scalaz.std.indexedSeq._
import scalaz.syntax.traverse._
((0 until 100):IxSq[Int]).foldLeftM[IxSq, Any](vector) {
case (vector: IxSq[Any], _) =>
vector
case (value: Any , _) =>
You can’t perform that action at this time.