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
import Data.Monoid | |
import Data.Maybe | |
import Data.List | |
data Finder a = Finder ([a] -> Maybe a) | |
instance Monoid (Finder a) where | |
mempty = Finder (const Nothing) |
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
/* | |
* Generate migration file: | |
* $ gulp create-migration --name update-tenant-auth-connectors | |
*/ | |
// Define migration | |
var systemService = require('<systemService>'), | |
systemTenant = systemService.systemTenant; | |
exports.up = Scaffold.defineMigration(function() { |
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 R = require('ramda'); | |
var rpn = R.compose(R.head, R.reduce(foldingFn, []), R.split(' ')); | |
function foldingFn(acc, v) { | |
if(isOperator(v)) { | |
var vs = R.take(2, acc), | |
rest = R.drop(2, acc); | |
return R.prepend(useOperator(v, vs), rest); |
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 List a = Empty | Cons a (List a) deriving (Eq) | |
instance Show a => Show (List a) where | |
show list = "(" ++ showListContents list ++ ")" | |
showListContents :: Show a => List a -> String | |
showListContents Empty = "" | |
showListContents (Cons x Empty) = show 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
'use strict'; | |
var R = require('ramda'); | |
var extract = R.invoke('extract', []); | |
var makeMonoid = R.curry(function(identity, binary, v) { |
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
'use strict'; | |
// All (||) operator as a monoid | |
function All(v) { | |
return { | |
value: v | |
}; | |
} |
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
'use strict'; | |
// Or (||) operator as a monoid | |
function Or(v) { | |
return { | |
value: v | |
}; | |
} |
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 Type | |
*/ | |
// Tree a = EmptyTree | Node a (Tree a) (Tree a) | |
/** | |
* Value Constructors | |
*/ |
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 PropertyGetterFactory(value) { | |
return { | |
get: function(prop) { | |
return mapToPropertyGetter(partial(get, prop), value); | |
}, | |
map: function(callback) { | |
return mapToPropertyGetter(callback, value); | |
}, | |
unwrap: always(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
var R = require('ramda'); | |
// [k] -> {k: a, load: fn} -> a | |
var getPath = R.curry(function(propList, entity) { | |
return getPathFromPropList(propList, entity); | |
}); | |
var getPathFromPropList = R.curry(function(propList, entity) { | |
var loadPattern = convertPropListToLoadPattern(propList); |