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/python | |
#encoding utf-8 | |
import sys, os | |
from itertools import takewhile | |
def getFuncs(filename, funcDef = "def "): | |
lines = open(filename,'r').readlines() | |
funcDefIn = lambda line: True if line.strip().startswith(funcDef) else False | |
funcs = map(lambda i: [lines[i]] + list(takewhile(lambda x: not funcDefIn(x),lines[i+1:])),filter(lambda i: funcDefIn(lines[i]),range(len(lines)))) | |
# grabs lines until start of next func/end of file lines where functions start |
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 Helpers.Heroku (herokuConf) where | |
import Prelude | |
import Data.ByteString (ByteString) | |
import Data.Text (Text) | |
import Data.Text.Encoding (encodeUtf8) | |
import Database.Persist.Postgresql (PostgresConf(..)) | |
import Web.Heroku (dbConnParams) | |
import qualified Data.Text as T |
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
;; 1. place this in ~/.emacs.d/private/intero/packages.el | |
;; 2. add intero, syntax-checking and auto-completion to your | |
;; ~/.spacemacs layer configuration & remove the haskell layer | |
;; if you were using that before | |
;; 3. make sure you have stack installed http://haskellstack.org | |
;; 4. fire up emacs & open up a stack project's source files |
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
// Gist: https://gist.github.com/plexsoup/64852540504101b520b25f7c3fa84e5f | |
// By: Plexsoup - copied from Mark by The Aaron. With help from Scott C, Stephen L and Tritlo | |
// Thanks: Testers and Feedback: al e., DM Robzer, Vince, Pat S, Gold, Anthony, Kryx, Sudain | |
// Contact: https://app.roll20.net/users/258125/plexsoup | |
// Roll20 API Script to leave a breadcrumb trail of torches. Based on "Mark" from The Aaron // | |
/* |
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 python3 | |
import uuid | |
import datetime | |
import time | |
# Configuration | |
bucket = 'REDACTED' #Make sure you have permissions to Put, Delete and Get. | |
path = "nullid/picam-" #The prefix of the pictures. |
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 ApplicativeDo #-} | |
module Main where | |
import Control.Concurrent | |
import Control.Concurrent.MVar | |
import Data.Time.Clock | |
-- We create a wrapper around IO for this example | |
newtype PIO a = PIO { runPIO :: IO a } |
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 TypeInType, TypeOperators #-} | |
module Main where | |
import Sorting | |
import ONotation | |
-- Here we say that sorted can use at most complexity N^2 and at most memory N^1 | |
-- and that the sort has to be stable. | |
mySort :: Sorted (O(N ^. 2)) (O(N)) True Integer |
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 RebindableSyntax #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE TypeInType #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
{-# LANGUAGE PartialTypeSignatures #-} | |
{-# LANGUAGE DeriveDataTypeable #-} |
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
-- This is a simple example showing the use of dependent typing in haskell, in a | |
-- vein similar to http://www.idris-lang.org/example/ | |
{-# LANGUAGE TypeFamilies, GADTs, TypeOperators, DataKinds, KindSignatures #-} | |
-- We can also just add TypeInType, and skip DataKinds and KindSignatures, | |
-- since TypeInType enables both of those, PolyKinds (and more!) | |
module Main where | |
import Data.Kind (Type) | |
-- Define a Type for the natural numbers, Zero and a successor |
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 GADTs #-} | |
import Data.List | |
import Data.Monoid | |
import Data.Typeable | |
import Data.Dynamic | |
import GHC.Err | |
import GHC.Prim |