View GaussSmoothen.h
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
#pragma once | |
#include <cmath> | |
#include <vector> | |
#include <assert.h> | |
inline double gauss(double sigma, double x) { | |
double expVal = -1 * (pow(x, 2) / pow(2 * sigma, 2)); | |
double divider = sqrt(2 * M_PI * pow(sigma, 2)); | |
return (1 / divider) * exp(expVal); |
View FTT.h
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
/** | |
* C++ implementation of FFT | |
* | |
* Source: http://paulbourke.net/miscellaneous/dft/ | |
*/ | |
#pragma once | |
/* | |
This computes an in-place complex-to-complex FFT |
View UTCTimeArbitrary.hs
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 Data.Time | |
instance Arbitrary UTCTime where | |
arbitrary = | |
do randomDay <- choose (1, 29) :: Gen Int | |
randomMonth <- choose (1, 12) :: Gen Int | |
randomYear <- choose (2001, 2002) :: Gen Integer | |
randomTime <- choose (0, 86401) :: Gen Int | |
return $ UTCTime (fromGregorian randomYear randomMonth randomDay) (fromIntegral randomTime) |
View hs-util.el
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
(defconst hs-imports-imports-start-regexp | |
(rx (group (and bol "import ")))) | |
(defconst hs-imports-language-start-regexp | |
(rx (group (and bol "{-# LANGUAGE ")))) | |
(defun hs-imports--search-beg-point (start what &optional end) | |
"Search the first import line until reach the END point." | |
(save-excursion |
View Api.hs
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 KindSignatures #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE TypeFamilies #-} | |
module Api | |
( Endpoint(..) | |
, Proxy(..) | |
, MaybeToList | |
, (<//>), var, Path(..), renderRoute | |
, Generic, ToJSON, FromJSON, NFData, Typeable |
View PCRETest.hs
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 Text.Regex.PCRE | |
regex = "dein(en)? ([^\\s]+)" | |
expected = [ [ "dein F\252ller", "", "F\252ller"] | |
, [ "deinen F\246hn", "en", "F\246hn"] | |
] | |
-- consider this being read from a file | |
inputStr = "Nimm dein F\252ller und nimm deinen F\246hn mit." |
View ElmCalc.elm
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 Main where | |
import StartApp | |
import String | |
import Html | |
import Html.Events as Html | |
import Html.Attributes as Html | |
import Html.Shorthand exposing (..) | |
import Bootstrap.Html exposing (..) | |
import Html exposing (blockquote) |
View elm-install.py
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 python2.7 | |
# This script is a hack until the elm-package install bug is fixed in docker containers | |
import urllib2 | |
import argparse | |
import tempfile | |
import os | |
import zipfile | |
import shutil | |
import json |
View haskell-do-match.js
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
var samples = | |
[ ' do var <- readTVar' | |
, 'do foo' | |
, 'main = do let x = do { foo }' | |
, 'main = do let x = do foo' | |
, 'main = foo $ do ' | |
]; | |
for (var i in samples) { | |
var line = samples[i]; |
View AtomicState.hs
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 #-} | |
{-# LANGUAGE RankNTypes #-} | |
module AtomicState | |
( getState, modifyState, forkThread, execAtomicStateT, AtomicStateT | |
, readState, runReadOnly, AtomicReadT | |
) | |
where | |
import Control.Monad.Reader | |
import Control.Concurrent |
NewerOlder