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 NoMonomorphismRestriction #-} | |
module Main where | |
import Debug.Trace (traceShow) | |
import Data.List (minimumBy, sortBy, genericLength) | |
import Control.Monad ((=<<), liftM, liftM2) | |
import Data.Maybe (fromJust) | |
trace1 x = traceShow x 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
{-# LANGUAGE NoMonomorphismRestriction #-} | |
module Main where | |
import Debug.Trace (traceShow) | |
import Data.List (minimumBy, sortBy, genericLength) | |
import Control.Monad ((=<<), liftM, liftM2) | |
import Data.Maybe (fromJust, isJust) | |
import System.IO (hPutStrLn, stderr) | |
import Control.Parallel (par, pseq) |
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
/* | |
After jquery ui datepicker selection, blur and change | |
events fire before focus is returned to the input field, | |
handling a quirk from IE browsers | |
*/ | |
function setupDatepicker() { | |
// The 'isIE' var below requires an '.old-ie' class to be set on the html, | |
// for example: | |
// <!--[if lt IE 7]> <html class="old-ie lt-ie9 lt-ie8 lt-ie7"> <![endif]--> | |
// <!--[if IE 7]> <html class="old-ie ie7 lt-ie9 lt-ie8"> <![endif]--> |
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
/* license: https://opensource.org/licenses/MIT */ | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Windows; | |
using System.Windows.Controls; | |
using System.Windows.Interactivity; | |
namespace Behaviors { |
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
interface IGetMethod { int GetValue(); } | |
interface ISetMethod { void SetValue(int value); } | |
interface IBothMethods : IGetMethod, ISetMethod { } | |
class BothMethods : IBothMethods | |
{ | |
int _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
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 |
OlderNewer