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
open Core.Std | |
module type Collection = sig | |
type 'a t | |
val create : unit -> 'a t | |
val add : 'a t -> 'a -> unit | |
val of_list : 'a list -> 'a t | |
val iter : 'a t -> f:('a -> unit) -> unit | |
end |
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
open Core.Std | |
open Core_extended.Std | |
open Async.Std | |
module Protocol = struct | |
module Client_message = struct | |
type t = | |
| Get of string | |
| Set of string * string | |
| Quit with sexp |
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
open Core.Std | |
open Async.Std | |
module Mvar : sig | |
type 'a t with sexp_of | |
include Invariant.S1 with type 'a t := 'a t | |
val create : unit -> _ t | |
val put : 'a t -> 'a -> unit Deferred.t | |
val take : 'a t -> 'a Deferred.t | |
end = struct |
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
# Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root | |
require 'thread.rb' | |
# Disposables | |
class Disposable | |
def initialize(&disposable_action) | |
@disposable_action = disposable_action |
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
{-# LANGUAGE OverloadedStrings #-} | |
module Inisec where | |
import Prelude as P | |
import Data.Attoparsec.Text | |
import Data.Text.IO as T | |
import Data.Text | |
import Control.Applicative | |
data Section = Section | |
{ entries :: [(Text, Text)] |
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
#!/usr/bin/env ruby | |
require 'fiber' | |
require 'set' | |
def state full_word, revealed | |
all_letters = full_word.split('') - [' '] | |
hidden = all_letters.to_set - revealed | |
hidden.inject(full_word) {|acc, e| acc.gsub e, '_' } | |
end |
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
def webapp2_handler(method): | |
allowed_methods = set(['GET', 'POST', 'DELETE', 'PUT']) | |
if method not in allowed_methods: | |
raise ValueError("%s is an invalid HTTP method" % method) | |
def wrap(f): | |
return type('', (webapp2.RequestHandler,), { | |
method.lower(): f | |
}) | |
return wrap |
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
type 'a option_parser = string list -> 'a list | |
type 'a handler = 'a list -> unit | |
type subcommand = | |
| Subcommand : 'a option_parser * 'a handler -> subcommand | |
let handle_run options = | |
let refresh = ref false in | |
let wrapper = ref None in |
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
module Bencode where | |
import Data.Maybe (fromJust) | |
import Control.Monad (liftM) | |
import Control.Applicative | |
import Data.ByteString.Char8 as BS | |
import Data.Attoparsec.ByteString.Char8 as A hiding (string) | |
import qualified Text.Show.Pretty as Pr | |
data Bencode = String ByteString |
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
open Core.Std | |
open Async.Std | |
let print_endline = Caml.print_endline | |
module Fiber : sig | |
val start : (unit -> 'a) -> 'a Deferred.t | |
val await : 'a Deferred.t -> 'a | |
end = struct | |
let active_prompt = ref None |
OlderNewer