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 AllowAmbiguousTypes #-} | |
{-# LANGUAGE ConstraintKinds #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE NoStarIsType #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE TypeApplications #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE TypeOperators #-} |
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
{ lib ? null, ... }: | |
let | |
net = { | |
ip = { | |
# add :: (ip | mac | integer) -> ip -> ip | |
# | |
# Examples: |
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 RankNTypes #-} | |
import Control.Lens hiding (lens) | |
import qualified Control.Lens as L (lens) | |
import Data.Bifunctor | |
import Data.Functor.Alt | |
------------------------------------------------------------------------------ | |
split |
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
class Method | |
def memoize!(time = nil) | |
name = self.name | |
owner = self.owner | |
method = self.to_proc | |
self.unbind | |
owner.send(:define_method, name) do |*args, &block| | |
@results ||= {} | |
if !@time || (time && @time + time < Time.now) | |
result = method.call(*args, &block) |
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
// http://www.w3.org/TR/html5/tabular-data.html#the-table-element | |
@mixin first-row() { | |
& >, | |
> thead >, | |
> tbody:first-child >, | |
> caption:first-child + tbody >, | |
> caption:first-child ~ colgroup + tbody >, | |
> colgroup:first-child + tbody >, | |
> colgroup:first-child ~ colgroup + tbody >, |
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/sh | |
clean () { | |
perl -pe 's/(\([si]\)\s*)+//' | tr '"' ' ' | awk '{$1=""; print $0}' | xargs echo | |
} | |
subset () { | |
python /usr/share/googlefontdirectory-tools/tools/subset/subset.py --subset=latin+latin-ext+greek+greek-ext+cyrillic+cyrillic-ext --nmr --null --roundtrip --script "$1" "$2" | |
} |
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.Applicative | |
import Data.Attoparsec | |
import Data.IORef | |
import System.IO.Unsafe | |
------------------------------------------------------------------------------ | |
wouldSucceed :: Parser a -> Parser Bool | |
wouldSucceed p = do | |
result <- return $! unsafePerformIO (newIORef False) | |
(do |
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 BangPatterns #-} | |
module Text.IDNA | |
( toASCII | |
, toUnicode | |
) | |
where | |
-- attoparsec ---------------------------------------------------------------- | |
import Data.Attoparsec.Text |
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
loadTemplates path = readDirectoryWith reader path | |
>>= (free | |
-- DirTree (Maybe (FilePath, Either String ByteString)) | |
>>> F.toList | |
-- [Maybe (String, Either String ByteString)] | |
>>> catMaybes | |
-- [(String, Either String ByteString)] | |
>>> unzip | |
-- ([String], [Either String ByteString]) | |
>>> second partitionEithers |
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 #-} | |
{-| | |
'Snap.Extension.Clever.Impl' is an implementation of the 'MonadClever' | |
interface defined in 'Snap.Extension.Clever'. | |
As always, to use, add 'CleverState' to your application's state, along with | |
an instance of 'HasCleverState' for your application's state, making sure to | |
use 'cleverInitializer' in your application's 'Initializer', and then you're |
NewerOlder