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
-- making and searching a binary search tree in haskell | |
data Tree a = EmptyTree | Node a (Tree a) (Tree a) deriving (Show) | |
singleton :: a -> Tree a | |
singleton x = Node x EmptyTree EmptyTree | |
treeInsert :: (Ord a) => a -> Tree a -> Tree a | |
treeInsert x EmptyTree = singleton x | |
treeInsert x (Node a left right) |
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
instance (Eq m) => Eq (Maybe a) where | |
Just m == Just n = m == n | |
Nothing == Nothing = True | |
_ == _ = False |
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
infixr 5 :-: | |
data List a = Empty | a :-: (List a) deriving (Show, Read, Eq, Ord) | |
infixr 5 ^++ | |
(^++) :: List a -> List a -> List a | |
Empty ^++ ys = ys | |
(x :-: xs) ^++ ys = x :-: (xs ^++ ys) |
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 Shapes | |
( Point(..) | |
, Shape(..) | |
, area | |
, nudge | |
, baseCircle | |
, baseRectangle | |
) where | |
data Point = Point Float Float deriving (Show) |
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 __componentLibrary = function () { | |
//an event source lets to add and remove listeners, trigger events and get the last value triggered | |
var EventSource = function () { | |
var _this = this; | |
_this.events = {}; | |
_this.values = {}; | |
_this.addEventListener = function (name, handler, noInitialEvent) { | |
if (_this.events.hasOwnProperty(name)) | |
_this.events[name].push(handler); |
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
<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<title></title> | |
<script src="Scripts/jquery-1.9.1.js"></script> | |
<script src="Scripts/jquery.validate.js"></script> | |
<script> | |
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(){ | |
function addSubscribeDispose(observable, subscribe, dispose) { | |
var subscriptions = []; | |
var oldSubscribe = observable.subscribe.bind(observable); | |
observable.subscribe = function (callback, callbackTarget, event) { | |
var oldDispose, ret; | |
ret = oldSubscribe(callback, callbackTarget, event); | |
if (!subscriptions.length) { | |
subscribe(); |
NewerOlder