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 node #// -*- Mode: Node.js JavaScript; tab-width: 4; -*- | |
/* | |
--- | |
url: http://gist.github.com/441101 | |
name : safari-get-html | |
description : safari-get-html will rock your socks! | |
authors : Thomas Aylott | |
copyright : © 2010 Thomas Aylott | |
license : MIT |
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
(ns finger-tree-stats | |
(:use [clojure.data.finger-tree])) | |
(defrecord stats [^double number ^double mean ^double variance]) | |
(def null-stats (stats. 0 0 Double/NaN)) | |
(defn make-stats | |
[^double x] | |
(stats. 1 x 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
#!/usr/bin/env runhaskell | |
-- Synopsis: | |
-- $ cabal install QuickCheck | |
-- $ runhaskell io_quickcheck_example.hs | |
-- | |
-- Author: Issac Trotts <issac.trotts@gmail.com> | |
import Directory | |
import System.Environment |
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
// Taken from the commercial iOS PDF framework http://pspdfkit.com. | |
// Copyright (c) 2014 Peter Steinberger, PSPDFKit GmbH. All rights reserved. | |
// Licensed under MIT (http://opensource.org/licenses/MIT) | |
// | |
// You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it. | |
// PLEASE DUPE rdar://27192338 (https://openradar.appspot.com/27192338) if you would like to see this in UIKit. | |
#import <objc/runtime.h> | |
#import <objc/message.h> |
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
enum Either<A, B> { | |
case Left(A) | |
case Right(B) | |
} | |
func isLeft<A,B>(it : Either<A,B>) -> Bool { | |
switch it { case .Left: return true; case .Right: return false } | |
} | |
func isRight<A,B>(it : Either<A,B>) -> Bool { |
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
> import Control.Monad.Trans | |
> import Control.Monad.Trans.Iter | |
The completely iterative free monad transformer lets us capture non-termination as an effect. Furthermore, it's a monad *transformer*, so we can add non-termination on top of other effects. | |
A convenient combinator is | |
> untilSuccess :: Monad m => m (Maybe a) -> IterT m a | |
> untilSuccess f = maybe (delay (untilSuccess f)) return =<< lift f |
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 Main where | |
import Control.Lens -- lens | |
import Control.Monad.IO.Class -- transformers | |
import Control.Monad.Trans.AWS -- amazonka | |
import Network.AWS.EC2 -- amazonka-ec2 | |
main :: IO () |
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 NoMonomorphismRestriction #-} | |
{-# LANGUAGE TemplateHaskell #-} | |
{-# OPTIONS_GHC -fwarn-missing-methods #-} | |
module Err where | |
import Control.Lens | |
import Control.Monad.Error | |
import Control.Monad.Error.Lens | |
-- Here is a fairly typical situation, where we have low level errors in certain |
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
{-# OPTIONS_GHC -Wall -fno-warn-unused-binds #-} | |
{-# LANGUAGE CPP #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE IncoherentInstances #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
#if __GLASGOW_HASKELL__ >= 708 | |
{-# LANGUAGE RoleAnnotations #-} | |
#endif |
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
#!/bin/bash | |
# Build, export, and publish the Nix dependencies of an Aurora job. | |
# Then use the aurora commandline utility to launch it. | |
# | |
# This should really be an Aurora client hook, or at least a | |
# better-integrated wrapper script. | |
set -e | |
attr=${1:?USAGE: $0 <attribute>} | |
shift |
OlderNewer