This file contains hidden or 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 mapFn(fn, functor) { | |
| return x => fn(functor(x)); | |
| } |
This file contains hidden or 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 mapObj(fn, obj) { | |
| var keys = Object.keys(obj) | |
| var newObj = {} | |
| for(var i = 0; i < keys.length; i++) { | |
| newObj[keys[i]] = fn(obj[keys[i]]); | |
| } | |
| return newObj | |
| } |
This file contains hidden or 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 zipObj from 'ramda/src/zipObj'; | |
| export function appendReducer(coreReducer, additionalReducers) { | |
| return (state, action) => { | |
| const newState = coreReducer(state, action); | |
| const keys = Object.keys(additionalReducers); | |
| const reducedValues = keys.map(k => additionalReducers[k](newState[k], action)); | |
| return {...newState, ...zipObj(keys, reducedValues)}; | |
| }; |
This file contains hidden or 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
| map'' :: (a -> b) -> [a] -> [b] | |
| map'' f as = foldl (\bs a -> bs ++ [f a]) [] as |
This file contains hidden or 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
| filter' :: (a -> Bool) -> [a] -> [a] | |
| filter' f as = foldl (\bs -> (\a -> if f a then bs ++ [a] else bs))[] as |
This file contains hidden or 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
| sum ns = foldl (+) 0 ns | |
| sum([1,2,3]) -- returns 6 |
This file contains hidden or 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
| (a -> Bool) -> [a] -> [a] |
This file contains hidden or 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
| // shorthand for $(document).ready(); | |
| $(function(){ | |
| $('form').on('submit', function(e){ | |
| e.preventDefault(); | |
| var email_regex = new RegExp("[a-zA-Z]+[@][a-zA-Z]+[.][a-z]{2,}"); | |
| var email_input = $('input[type=text]').val(); | |
| var email_match = email_regex.test(email_input); | |
| if (email_match == false){ |
This file contains hidden or 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> | |
| <head> | |
| <link rel="stylesheet" href="http://cdn.jsdelivr.net/normalize/2.1.0/normalize.css"> | |
| <link rel="stylesheet" href="main.css"> | |
| <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800"> | |
| <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato:100,900"> | |
| <link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.0.2/css/font-awesome.min.css"> | |
| </head> |