Skip to content

Instantly share code, notes, and snippets.

Franklin Chen FranklinChen

Block or report user

Report or block FranklinChen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am franklinchen on github.
  • I am franklinchen (https://keybase.io/franklinchen) on keybase.
  • I have a public key ASDhVqCYgr6xkfxsfiM5OWYrkqFtO0Rc6P6wKgk8Mh8Xhwo

To claim this, I am signing this object:

@FranklinChen
FranklinChen / # shibboleth-sp - 2016-09-28_16-50-24.txt
Created Sep 28, 2016
shibboleth-sp on macOS 10.12 - Homebrew build logs
View # shibboleth-sp - 2016-09-28_16-50-24.txt
Homebrew build logs for shibboleth-sp on macOS 10.12
Build date: 2016-09-28 16:50:24
@FranklinChen
FranklinChen / playground.rs
Created Nov 15, 2015 — forked from anonymous/playground.rs
Shared via Rust Playground
View playground.rs
use std::sync::{Arc, Mutex};
use std::thread;
struct Toaster {
count: u32
}
impl Toaster {
fn new() -> Toaster {
Toaster { count: 0 }
@FranklinChen
FranklinChen / playground.rs
Last active Nov 15, 2015 — forked from anonymous/playground.rs
Shared via Rust Playground
View playground.rs
use std::thread::{spawn, sleep_ms};
use std::sync::mpsc::channel;
fn main() {
// Names of attendees.
let names = vec![format!("A"), format!("B"), format!("C"), format!("D"), format!("E")];
// Create a channel to communicate between attendees and the toaster.
let (toaster_tx, toaster_rx) = channel();
View test-pipes-recursive.hs
-- | http://stackoverflow.com/questions/14259229/streaming-recursive-descent-of-a-directory-in-haskell/14261710#14261710
--
-- Updated to latest Pipes 4.
module Main where
import Pipes
import qualified Pipes.Prelude as P
import Control.Monad (forM_)
import System.Directory (doesDirectoryExist, getDirectoryContents)
View algebras.hs
{-# LANGUAGE RankNTypes, DeriveFunctor #-}
{-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
module Main where
import Criterion.Main (defaultMain, bench, bgroup, nf)
--------------------------------------------------------------------------------
-- Fixed points of a functor
newtype Mu f = Mu { muF :: f (Mu f) }
@FranklinChen
FranklinChen / walk-tree.hs
Created Apr 26, 2015
Merge a list of annotations into selected nodes of a tree, with error recovery and reporting
View walk-tree.hs
-- | Something for work, prototyped first in Haskell before turning
-- into Scala
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE LambdaCase #-}
import Test.Hspec
import Control.Monad.State
View OverloadedNonsense.hs
{-# LANGUAGE OverloadedStrings #-}
import Data.String
data Value = VInt Int
| VString String
-- In order to hide the unitype details from the user.
instance Show Value where
show (VInt i) = show i
@FranklinChen
FranklinChen / PointFreeExample.hs
Created Oct 6, 2014
Example of point-free style
View PointFreeExample.hs
import Control.Category ((>>>))
data Option = Option { name :: String }
-- Point-free style. Is this readable?
--
-- An Option matches a String if: we get the name of the Option and then prepend "--" to it, test whether that is equal
-- to the given String.
matches :: Option -> String -> Bool
matches = name >>> ("--" ++) >>> (==)
View spark.hs
-- Response to https://twitter.com/mfeathers/status/495979138365149184
-- Based on http://git.zx2c4.com/spark/tree/spark.c
import System.IO (hPutStrLn, stderr)
import System.Environment (getArgs)
import qualified Data.ByteString as B
import qualified Data.ByteString.Char8 as C
main :: IO ()
main = do
You can’t perform that action at this time.