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 Text.Read | |
-- Each invocation consumes strings from a stream | |
-- So canonically, we apply ([String],()) yielding | |
-- ([String],a) | |
data SampleMonadValue a | |
= SMV ([String] -> Either ([String],[String]) ([String],[String],a)) | |
sampleWrite :: String -> SampleMonadValue () | |
sampleWrite s = SMV $ \strings -> |
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
#!/bin/sh | |
bsb -make-world | |
browserify -o demo.js ./src/demo.bs.js | |
(echo 'foo = exports || {};' && cat demo.js) > demolambda.js |
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
{-- | |
Learning proof in idris. | |
My first complete proof. | |
Bin is a data type that uniquely represents Nat numbers in binary. It contains a representation | |
only for a BNil element and "N zeros followed by a 1", which means that each Nat corresponds to | |
precisely one Bin. |
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
{-- THIS IS AN EXAMPLE OF UNSOUND PROOF -- IT IS THE PRODUCT OF A CONFUSED MIND --} | |
data Bin = O Nat Bin | BNil | |
{- | |
total aNEBMeansNotEqual : (a : Nat) -> (b : Nat) -> (v : Bin) -> Dec (a = b) -> Dec (O a v = O b v) | |
aNEBMeansNotEqual a b v (Yes prf) = rewrite prf in Yes Refl | |
aNEBMeansNotEqual a b v (No contra) = No ?contraHell | |
-} |
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
data IsEven : (b : Bool) -> Type where | |
ItIsEven : IsEven True | |
Uninhabited (IsEven False) where | |
uninhabited IsEven impossible | |
itHasTheOneBitSet : (n : Nat) -> Bool | |
itHasTheOneBitSet Z = False | |
itHasTheOneBitSet (S Z) = True | |
itHasTheOneBitSet (S (S a)) = itHasTheOneBitSet a |
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
var fs = require('fs'); | |
var readline = require('readline'); | |
var google = require('googleapis'); | |
var googleAuth = require('google-auth-library'); | |
// If modifying these scopes, delete your previously saved credentials | |
// at ~/.credentials/sheets.googleapis.com-nodejs-quickstart.json | |
var SCOPES = ['https://www.googleapis.com/auth/spreadsheets.readonly']; | |
var TOKEN_DIR = (process.env.HOME || process.env.HOMEPATH || | |
process.env.USERPROFILE) + '/.credentials/'; |
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
#r "../node_modules/fable-core/Fable.Core.dll" | |
#r "../node_modules/fable-powerpack/Fable.PowerPack.dll" | |
#r "../node_modules/fable-react/Fable.React.dll" | |
#r "../node_modules/fable-elmish/Fable.Elmish.dll" | |
#r "../node_modules/fable-elmish-react/Fable.Elmish.React.dll" | |
open Elmish | |
open Elmish.React | |
module R = Fable.Helpers.React |
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
-- Try to setup auto logout. But JWT parsing can fail in several ways. | |
-- | |
-- Failure strategy: | |
-- 1. Console log failure. | |
-- 2. The fallback (not shown below) is to instruct the user to | |
-- manually log out and back in when we receive 401 Unauthorized. | |
-- | |
-- TODO send failure to logging infrastructure. | |
notifyOnExpired : String -> Cmd Msg |
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 HmacSha256 exposing (hmac, packedStringOfIntArray, intArrayOfPackedString, presentableIntArray, presentationToIntArray) | |
import Array exposing (Array) | |
import Bitwise | |
import Char | |
import Debug exposing (log) | |
import ParseInt as I | |
{-- Note: relies on a modified version of billstclair's sha256 module with utf-8 handling disabled --} | |
import Sha256 exposing (sha256) |
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
> ᴛyᴩᴇ = 3 | |
3 : number | |
> type Tyᴩᴇ ᴛyᴩᴇ = Tyᴩᴇ ᴛyᴩᴇ | |
> ʇʎdǝ = 4 | |
4 : number | |
> isPlayingॽ x = x /= Nothing | |
<function> : Maybe.Maybe a -> Bool | |
> isPlayingॽ (Just 3) | |
True : Bool | |
> aᐃ = 3 |