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 Hakyll.Web.Archives | |
( Archives | |
, buildArchives | |
, archiveField | |
, archiveRules) where | |
import Control.Applicative | |
import Data.List (intercalate, sort) | |
import Data.Time | |
import System.Locale (defaultTimeLocale) |
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
# So.. I wrote a parser for that... I know there are many easier ways, | |
# but this parser just feels more generic and with a little extension | |
# for result handling, it can actually be extended to a fully functional | |
# recursive descendant parser. | |
# The parser is based on Monadic Parsing common in functional languages | |
class Parser: | |
def parse(self, a): | |
pass |
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 GeneralizedNewtypeDeriving #-} | |
import Data.Maybe (fromJust) | |
import System.Random (randomIO) | |
import Control.Applicative | |
import Control.Monad.State.Strict | |
newtype GameAction s a = GameAction { getAction :: StateT s Maybe a } | |
deriving (Monad, Applicative, Functor, MonadState s, Alternative) | |
condition :: (s -> Bool) -> GameAction s () |
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 python | |
# Original template: Google io 2012: | |
# https://code.google.com/p/io-2012-slides/ | |
# Now you can add section to your slide's metadata, which makes it | |
# easier to adapt to academic presentation | |
# e.g: | |
# --- | |
# section: foo bar | |
# title: ..... | |
# |
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
// Alternative implementation of bind without using placeholders. | |
// usage: | |
// Given void func(int a, int b, int c); | |
// auto f = my_bind(func, 3, 2); | |
// Then f(5) is the same as func(3, 2, 5); | |
// Also if first parameter is a weak pointer, this bind does the | |
// weak check automatically. | |
// For weak check to work successfully, the function needs to have void | |
// return type. |
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
// A toy C++ FRP framework. | |
// Author: Bruce Li (github.com/kkspeed) | |
// Licensed under BSD. | |
// | |
// Note: | |
// 1. Compiles with C++ 17 | |
// 2. Signal values are copy-constructable. Non-copyconstructable values | |
// could be wrapped in shared_ptr. | |
// 3. Signal graph is statically connected and unsubscription is not | |
// an option. |
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
use std::cell::RefCell; | |
use std::rc::Rc; | |
struct Core<T> { | |
observers: Vec<Box<Fn()>>, | |
value: Option<T>, | |
} | |
impl<T> Core<T> | |
where |
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
// Demonstrates C++ type list. | |
// Author: Bruce Li (github.com/kkspeed) | |
// Licensed under BSD. | |
// Requires C++ 11 except Filter. Filter requires C++14. | |
#include <string> | |
#include <type_traits> | |
// A typelist is a list of types. The list is similar to | |
// lists in functional languages like Lisp. |
OlderNewer