Skip to content

Instantly share code, notes, and snippets.

open Js
let f1 c =
c##prop1 <- true
(*
Val: val ff1 : < prop1 : < set : bool -> unit; .. > Js.gen_prop;
prop2 : < get : < prop1 : < set : bool -> unit; .. >
Js.gen_prop;
.. >
Js.t;
@zakki
zakki / gist:9245879
Created February 27, 2014 07:29
FizzBuzz
public class Foo {
public static void main(String[] args) {
try {
if (new javax.script.ScriptEngineManager().getEngineByExtension("js").eval(
"var i = 1\n" +
"while (i < 100) {\n" +
"if (i % 15 == 0) println('FizzBuzz')\n" +
"else if (i % 3 == 0) println('Fizz')\n" +
"else if (i % 5 == 0) println('Buzz')\n" +
"else println(i)\n" +
module A {
export module B {
export var C:any = {}
}
}
module A {
export module B {
console.log("1", C);
function f(B) {
let f a =
let t0 = Unix.gettimeofday() in
let acc = ref a in
for j = 1 to 10000000 do
acc := !acc +. (float_of_int j)
done;
let t1 = Unix.gettimeofday() in
Printf.printf "Time: %.3f %f\n%!" (t1-.t0) !acc
let _ =
public class Nan {
static void f(double a) {
long t0 = System.nanoTime();
double acc = a;
for (int i = 0; i < 100000000; i++) {
acc += i;
}
long t1 = System.nanoTime();
System.out.println("time:" + (t1 - t0) / 1000000 + " " + acc);
// http://d.hatena.ne.jp/nowokay/20140330#1396177524
import java.util.*;
import java.util.function.*;
import java.util.stream.*;
public class LoopBench2 {
public static void main(String[] args) {
List<Integer> list = IntStream.range(0, 100_000).boxed().collect(Collectors.toList());
array = list.toArray(new Integer[0]);
for (int i = 0; i < 10; i++) {
int code_execcmd( void )
{
//...
try {
while(1) {
if ( GetTypeInfoPtr( type )->cmdfunc( val ) ) { // タイプごとの関数振り分け
if ( hspctx->runmode == RUNMODE_RETURN ) {
cmdfunc_return();
} else {
hspctx->msgfunc( hspctx );
class type _JQueryAjaxSettings = object
method accepts : Ts.any Js.prop
method async : Ts.typeReference Js.prop
method beforeSend : (Ts.typeReference -> Ts.typeReference -> Ts.any) Js.prop
method cache : Ts.typeReference Js.prop
method complete : (Ts.typeReference -> Ts.string -> Ts.any) Js.prop
method contents : Ts.typeLiteral Js.prop
method contentType : Ts.string Js.prop
method context : Ts.any Js.prop
method converters : Ts.typeLiteral Js.prop
RewriteEngine on
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{REQUEST_FILENAME}\.gz -s
RewriteRule .+ %{REQUEST_URI}.gz
<FilesMatch "\.js\.gz$">
ForceType application/x-javascript
AddEncoding x-gzip .gz
</FilesMatch>
class A {
private m = 123;
func(ev: Event) {
console.log(this);
console.log(this.m);
}
}
var a = new A();