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
// Copyright (c) 2014 Tenor Biel | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions: | |
// | |
// The above copyright notice and this permission notice shall be included in |
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
// Copyright (c) 2014 Tenor Biel | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions: | |
// | |
// The above copyright notice and this permission notice shall be included in |
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 TemplateHaskell #-} | |
module Rl where | |
import Control.Monad.Trans.State | |
import Control.Lens | |
import Text.Read (readMaybe) | |
import qualified Data.Map as M | |
import Control.Monad.IO.Class | |
import Control.Applicative (liftA2) |
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
% comments are like this | |
% outside of operator precedence, the only special | |
% syntax is ':-' and ':='. ':=' is used for a type | |
% annotation. Types are just additional predicate | |
% calls, but they are restricted to not using IO | |
% values or ambigious stuff a compiler couldn't | |
% figure out. | |
my_predicate := true. % my_predicate is valid under any pretense |
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
function archiveWeeks(tasks) { | |
return lodash.chain(tasks) | |
.reverse() | |
.groupBy({created_at} => new Date(created_at.getFullYear(), created_at.getMonth(), created_at.getDate())) | |
.map((t, d) => {date: new Date(d), tasks: t}) | |
.groupBy(weekOf) // because I'm lazy | |
.map((d, w) => {week: w, days: d}) | |
.value(); | |
} |
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
findById :: User.Id -> forall s. Tx Postgres s (Maybe User) | |
findById userId = do | |
result <- maybeEx [stmt| | |
SELECT id, email, created_at, updated_at | |
FROM users | |
WHERE id = $userId | |
|] | |
return case result of | |
Just row -> toUser row |
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
let wm = new WeakMap(); | |
class Foo { | |
constructor () { | |
var privateData = {}; | |
wm.set(this, privateData); | |
privateData.myProperty = 1; | |
} |
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
return d.getUTCFullYear() | |
+ '-' + zeroFill(d.getUTCMonth() + 1, 2) | |
+ '-' + zeroFill(d.getUTCDate(), 2) | |
+ 'T' + zeroFill(d.getUTCHours(), 2) | |
+ ':' + zeroFill(d.getUTCMinutes(), 2) | |
+ ':' + zeroFill(d.getUTCSeconds(), 2) | |
+ '.' + zeroFill(d.getUTCMilliseconds() * 1000, 6) | |
+ 'Z'; |
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
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSB6JUsqH814A5N78yQv/vy2UvHDUQGSIkknGiwRyQjX5h4aodgM6unvcIo1kZUldDCa4kxoUP1hN2Slb9UNWH/gwvSwmHI5T6M8W6b2kEcv4PX5BBn+V2aNI5KULq3OOevIrv5ofYf0shqRmX39mxLd2UU5tVLGYrx9OdYFK+2aRU6PJfMU8g2z6ArEqIvur81TeFnqdCMcihkM/1SnmBn/7c+/TfvjNm6xBBk2MC5Pw6iSTGi/JkIllMCXfV8FFvs4hYl0vfUowbBFdp5VQNrbYIJ8Qnn09hAilyFTRTlidkgAiAjr78pkClsisUA/M9lSjeD6G/7yhfO8o+Xv9J seed@Alex |