This file contains hidden or 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
// Diary action creators | |
export class Diary { | |
static RECEIVE = 'DIARY_RECEIVE' | |
static actions = { | |
fetchByDate: (date) => { | |
const done = (dispatch, json) => dispatch(replace(`/diary/${json.id.toString()}`)) | |
return post('/api/diary', Diary.RECEIVE, { date }, done) | |
}, | |
fetchById: (logId) => { |
This file contains hidden or 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
-- buildPatSynDetails, so this is a mempty, even the type | |
-- we generate the same location here. | |
hsConDeclDetails _ = pprPanic "tcLHsBindsCtOrigin" (ppr val_val_binds) | |
-------------------- | |
zonkForeignCall :: FlexibleInfo -> CoreBind | |
-> Maybe FreeVars -- True <=> supplied EndBinds | |
-> RecFlag | |
-> Cts -> ForeignOpt Id |
This file contains hidden or 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.Maybe | |
import System.IO (readFile) | |
-- Open a file and process its contents with action, or return the default value 'deflt' | |
maybeWithFile :: Maybe FilePath -> b -> (String -> b) -> IO b | |
maybeWithFile fname deflt action = maybe (return deflt) (fmap action . readFile) fname | |
main :: IO () | |
main = do | |
let inactiveWhitelist = Just "whitelist.txt" |
This file contains hidden or 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
cmake_minimum_required (VERSION 2.6) | |
project (example) | |
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") | |
add_executable(example main.cpp) |
This file contains hidden or 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 #-} | |
import Control.Applicative | |
import qualified Data.Text as T | |
import Database.SQLite.Simple | |
import Database.SQLite.Simple.FromRow | |
data TestField = TestField Int T.Text deriving (Show) | |
instance FromRow TestField where |
This file contains hidden or 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
all: | |
gcc -g main.c b.c -o test |
This file contains hidden or 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 ScopedTypeVariables, OverloadedStrings #-} | |
import Data.Aeson | |
import Data.Time (UTCTime) | |
main = do | |
let Just (t :: [UTCTime]) = decode' "[\"2014-04-28T05:05:05.000Z\"]" | |
print t | |
let Just (t :: [UTCTime]) = decode' "[\"2014-04-28T05:05:05Z\"]" | |
print t | |
-- The below examples do not parse with aeson 0.7.0.3 |
This file contains hidden or 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 TemplateHaskell #-} | |
import Control.Lens | |
data A = A { | |
_aId :: Int | |
, _bs :: [B] | |
} deriving (Show) | |
data B = B { |
This file contains hidden or 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 qualified Data.Text as T | |
main :: IO () | |
main = putStrLn (T.unpack . T.pack $ "hello") |
This file contains hidden or 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
#include <stdio.h> | |
static inline float uintToFloat(unsigned int v) | |
{ | |
union { | |
unsigned int ui; | |
float f; | |
} c; | |
c.ui = v; | |
return c.f; |