This file contains hidden or 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
import org.scalajs.dom | |
import dom.document | |
import scala.scalajs.js.JSApp | |
import scalaz.Nondeterminism | |
import scalaz.concurrent.Future | |
import scalaz.concurrent.Task | |
import scalaz.Free.Trampoline | |
import scalaz.\/._ | |
import scala.collection.mutable.Queue | |
import scalaz._ |
This file contains hidden or 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
module type Show = sig | |
val show : 'a -> string | |
end | |
module Show = struct | |
external show : 'a -> string = "%OVERLOADED" | |
module Int = struct | |
let show = string_of_int | |
end |
This file contains hidden or 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
open Core.Std | |
let libguess_determine_encoding = | |
let open Ctypes in | |
Foreign.foreign "libguess_determine_encoding" (string @-> int @-> string @-> returning string) | |
type metadata = { | |
title : string option; | |
type_ : string option; | |
description : string option; |
This file contains hidden or 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
$ sudo apt-get install libguess-dev | |
$ ocamlfind ocamlc -package ctypes.foreign -linkpkg -custom -cclib -lguess -o guess guess.ml | |
$ ./guess "こんにちは世界" | |
UTF-8 | |
$ ./guess $(echo "こんにちは世界" | nkf -Ws) | |
SJIS | |
$ ./guess $(echo "こんにちは世界" | nkf -We) | |
EUC-JP |
This file contains hidden or 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
WITH RECURSIVE t AS ( | |
SELECT source, target FROM edge | |
UNION | |
SELECT e.source, t.target FROM edge e INNER JOIN t ON e.target = t.source | |
) | |
SELECT target FROM t WHERE source = 123 |
This file contains hidden or 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
module Test = struct | |
include Ppx_test.Test | |
let eval = Async_unix.Thread_safe.block_on_async_exn | |
let test_unit loc name deferred = | |
test_unit loc name (fun () -> eval deferred) | |
let test loc name deferred = | |
test loc name (fun () -> eval deferred) |
This file contains hidden or 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
open Easyjs | |
let () = begin%js | |
let foobar = {| jQuery("#foobar") |} in | |
let value = of_string "Hello, World!" in | |
let callback _ = {| ${foobar}.text(${value}) |} in | |
ignore {| window.setTimeout(${fn callback}, 1000) |} | |
end |
This file contains hidden or 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
module type Show = sig | |
type t | |
val show : t -> string | |
end | |
let show (implicit S : Show) x = S.show x | |
module Show_instances = struct | |
implicit module Show_unit = struct | |
type t = unit |
This file contains hidden or 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
open Core.Std | |
open Async.Std | |
type 'a t = { | |
capacity : int; | |
generate : unit -> 'a Deferred.t; | |
validate : 'a -> bool Deferred.t; | |
mutable in_use : int; | |
free : 'a Queue.t; | |
waiters : 'a Ivar.t Queue.t; |
This file contains hidden or 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
open Core.Std | |
open Async.Std | |
module type PGOCaml_async_thread = | |
PGOCaml_generic.THREAD | |
with type 'a t = 'a Deferred.t | |
module PGOCaml_async_thread : PGOCaml_async_thread = struct | |
type 'a t = 'a Deferred.t |
NewerOlder