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
using System; | |
using System.Collections.Generic; | |
using System.Data; | |
using System.Data.Common; | |
using System.Data.Entity; | |
using System.Data.Entity.Infrastructure.Interception; | |
using System.Data.Entity.ModelConfiguration; | |
using System.Diagnostics; | |
using System.Linq; | |
using System.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
data CvSize = CvSize { sizeWidth :: CInt, sizeHeight :: CInt } | |
deriving (Show, Eq) | |
instance Storable CvSize where | |
sizeOf _ = (#size CvSize) | |
alignment _ = alignment (undefined :: CInt) | |
peek ptr = do | |
w <- (#peek CvSize, width) ptr | |
h <- (#peek CvSize, height) ptr |
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 Test where | |
import Data.Either(isLeft, lefts, isRight) | |
data Type = Unknown | JNumber | JString | JRegex | JArray Type | JObject [(String, Type)] | JFunc [Type] Type | |
data Expr = LitNumber Double | LitString String | LitRegex String | LitArray [Expr] | LitObject [(String, Expr)] | |
| Var String -- TODO: perhaps there should only be Property (and for function scopes use a hidden base obj?) | |
| Plus Expr Expr | Minus Expr Expr | |
| Assign Expr Expr | |
-- | Property Expr String |
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
Expr (Call (Expr (LitFunc ["x"] | |
(Expr (Var "x") | |
(Right Context {parent = Context {parent = Context {parent = Global, | |
vars = [], | |
curType = Top}, | |
vars = [("x", | |
TVar "x")], | |
curType = Top}, | |
vars = [], | |
curType = TVar "x"}))) |
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 Test where | |
import Data.Maybe | |
import Control.Monad | |
import Control.Monad.Trans | |
import Control.Monad.Trans.Maybe | |
import Control.Monad.Trans.Maybe(MaybeT(..)) | |
import Control.Monad.State(State, runState, forM, get, put) | |
positiveOnly :: Int -> Maybe Int |
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
Started GET "/api/system_status?_=1412070154562" for 127.0.0.1 at 2014-09-30 12:42:34 +0300 | |
Processing by Api::V1::SystemStatusesController#index as JSON | |
Parameters: {"_"=>"1412070154562"} | |
LocalUser Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."type" IN ('LocalUser') AND "users"."id" = 2 ORDER BY "users"."id" ASC LIMIT 1 | |
Completed 500 Internal Server Error in 2ms (Views: 0.1ms | ActiveRecord: 0.2ms) |
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 WikiNews where | |
import Network.HTTP(simpleHTTP, getRequest, getResponseBody) | |
import Data.List(isInfixOf, intersperse) | |
import Data.Char(isSpace, toLower) | |
import Control.Category((>>>)) | |
import System.Random(getStdGen) | |
-- from package tagsoup: |
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 debounce(f, millis) { | |
var ready = true; | |
var timeoutId; | |
var lastMissed; | |
function resetTimeout(){ | |
window.clearTimeout(timeoutId); | |
timeoutId = window.setTimeout(function() { | |
if (lastMissed) { | |
lastMissed(); | |
} |
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 -> c) | |
// c | |
var id = function(x) { return x; }; | |
// (i -> i) | |
// TNumber | |
var num = id(3); | |
// (n -> n) | |
// TString | |
var str = id('a'); |
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 FlexibleContexts, FlexibleInstances #-} | |
module FixT where | |
data Expr = Val | |
| Divide Expr Expr | |
| Times Expr Expr | |
deriving Show | |
flipDivide :: Expr -> Expr | |
flipDivide Val = Val |
OlderNewer