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
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.4.2/react.min.js"></script> |
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> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<style id="jsbin-css"> | |
.main { | |
font-size: 18px; | |
} |
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
var fs = require('fs'); | |
var vm = require('vm'); | |
var exp = require('express'); | |
var app = exp(); | |
var script = new vm.Script(fs.readFileSync("t2.js", 'utf8')); | |
var context = { module: {} }; | |
var fn = script.runInNewContext(context); |
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
--log_gc (Log heap samples on garbage collection for the hp2ps tool.) | |
type: bool default: false | |
--expose_gc (expose gc extension) | |
type: bool default: false | |
--max_new_space_size (max size of the new generation (in kBytes)) | |
type: int default: 0 | |
--max_old_space_size (max size of the old generation (in Mbytes)) | |
type: int default: 0 | |
--max_executable_size (max size of executable memory (in Mbytes)) | |
type: int default: 0 |
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
@scala.annotation.tailrec | |
def _insertSort[T](x1: List[T], x2: List[T])(p: (T, T) => Boolean): List[T] = x2 match { | |
case Nil => x1 | |
case x2_head :: x2_tail => | |
val (x1_left, x1_right) = x1.partition( x => p(x, x2_head) ) | |
val x1_new = (x1_left ::: (x2_head :: x1_right)) | |
_insertSort(x1_new, x2_tail)(p) | |
} | |
def insertSort[T](xs: List[T])(p: (T, T) => Boolean) = xs match{ |
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 Op(var x : Int) { | |
def +++(op: Op) = { println(this.x+ " +++ "+op.x); this.x += op.x; this;} | |
def ***(op: Op) = { println(this.x+ " *** " + op.x); this.x *= op.x ; this;} | |
} | |
val op1 = new Op(1) | |
val op2 = new Op(2) | |
val op3 = new Op(3) | |
val op4 = new Op(4) | |
op1 +++ op2 +++ op3 *** op4 //be equivalent to op1 +++ op2 +++ (op3 *** op4) |
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 TernaryOp { | |
class Ternary[T](t: T) { | |
println("Ternary") | |
def is[R](bte: BranchThenElse[T,R]) = { | |
println("is ... ") | |
if (bte.branch(t)) bte.then(t) else bte.elze(t) | |
} | |
} | |
class Branch[T](branch: T => Boolean) { | |
println("branch"); |
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
abstract class BizService { | |
def doIt() | |
} | |
class Worker extends BizService { | |
def doIt() {println("I am working")} | |
} | |
trait Logger extends BizService { | |
abstract override def doIt() {println("logMe first");super.doIt()} |
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
package com.travelsky.esb.emd.utils; | |
import org.mule.util.IOUtils; | |
import java.io.*; | |
import java.util.zip.GZIPInputStream; | |
import java.util.zip.GZIPOutputStream; | |
/** | |
* Created by IntelliJ IDEA. |
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
test |