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
| var CryptoJS = require("crypto-js");//replace thie with script tag in browser env | |
| //encrypt | |
| var rawStr = "hello world!"; | |
| var wordArray = CryptoJS.enc.Utf8.parse(rawStr); | |
| var base64 = CryptoJS.enc.Base64.stringify(wordArray); | |
| console.log('encrypted:', base64); | |
| //decrypt | |
| var parsedWordArray = CryptoJS.enc.Base64.parse(base64); |
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
| const I = x => x; | |
| const K = x => y => x; | |
| const A = f => x => f(x); | |
| const T = x => f => f(x); | |
| const W = f => x => f(x)(x); | |
| const C = f => y => x => f(x)(y); | |
| const B = f => g => x => f(g(x)); | |
| const S = f => g => x => f(x)(g(x)); | |
| const P = f => g => x => y => f(g(x))(g(y)); | |
| const Y = f => (g => g(g))(g => f(x => g(g)(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
| /*eslint-env es6 */ | |
| // Inspired by the paper "A tutorial on the universality and | |
| // expressiveness of fold" by Graham Hutton (available at | |
| // http://www.cs.nott.ac.uk/~gmh/fold.pdf), implementing some generic | |
| // list handling functions in JavaScript in terms of `fold`. | |
| // Personally I had an enlightnening moment when I realised the | |
| // beautiful interplay of cons lists and foldr during the FP101x | |
| // Haskell course. JavaScript's syntax doesn't make this very apparent |
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> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/rxjs/4.0.6/rx.all.js"></script> | |
| <script src="https://cdn.rawgit.com/Reactive-Extensions/RxJS-DOM/master/dist/rx.dom.js"></script> | |
| <meta charset="utf-8"> | |
| <title>JS Bin</title> | |
| </head> | |
| <body> |
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
| // Load plugins | |
| var gulp = require('gulp'), | |
| sass = require('gulp-ruby-sass'), | |
| autoprefixer = require('gulp-autoprefixer'), | |
| minifycss = require('gulp-minify-css'), | |
| jshint = require('gulp-jshint'), | |
| uglify = require('gulp-uglify'), | |
| imagemin = require('gulp-imagemin'), | |
| rename = require('gulp-rename'), | |
| clean = require('gulp-clean'), |