Skip to content

Instantly share code, notes, and snippets.

View winterland1989's full-sized avatar
🎯
Focusing

winterland winterland1989

🎯
Focusing
View GitHub Profile
@winterland1989
winterland1989 / es5 generator
Last active September 22, 2015 10:16
an es5 generator...
generator = (fn) ->
nexts = []
fn (next) ->
if (x = nexts.indexOf next) != -1
nexts.push x
else nexts.push next
step = 0
next: ->
next = nexts[step++]
if next != undefined
@winterland1989
winterland1989 / BitTwiddle.hs
Last active July 1, 2017 00:19
BitTwiddle with haskell
{-# LANGUAGE CPP #-}
{-# LANGUAGE MagicHash #-}
-- | This module provide fast memchr implemented with ghc primitives.
--
-- http://lemire.me/blog/2017/01/20/how-quickly-can-you-remove-spaces-from-a-string/
-- https://graphics.stanford.edu/~seander/bithacks.html
-- https://jameshfisher.github.io/2017/01/24/bitwise-check-for-zero-byte.html
--
--