Skip to content

Instantly share code, notes, and snippets.

View arcseldon's full-sized avatar

Richard Seldon arcseldon

View GitHub Profile
@arcseldon
arcseldon / coyo_uses.js
Created February 28, 2016 06:31 — forked from DrBoolean/coyo_uses.js
Coyoneda Uses in JS
const daggy = require('daggy')
const compose = (f, g) => x => f(g(x))
const id = x => x
//===============Define Coyoneda=========
const Coyoneda = daggy.tagged('x', 'f')
Coyoneda.prototype.map = function(f) {
return Coyoneda(this.x, compose(f, this.f))
}
@arcseldon
arcseldon / free-er2.js
Created February 28, 2016 06:29 — forked from DrBoolean/free-er2.js
Free(er) Monads Pt2
const daggy = require('daggy')
const Task = require('data.task')
const _ = require('lodash')
const kleisli_comp = (f, g) => x => f(x).chain(g)
const compose = (f, g) => x => f(g(x))
const id = x => x
//=============FREE=============
const Free = daggy.taggedSum({Impure: ['x', 'f'], Pure: ['x']})
const {Impure, Pure} = Free
@arcseldon
arcseldon / free-er.js
Created February 28, 2016 06:29 — forked from DrBoolean/free-er.js
Free(er) monads in JS (pt 1)
const daggy = require('daggy')
const compose = (f, g) => x => f(g(x))
const id = x => x
const kleisli_comp = (f, g) => x => f(x).chain(g)
//=============FREE=============
const Free = daggy.taggedSum({Impure: ['x', 'f'], Pure: ['x']})
const {Impure, Pure} = Free
@arcseldon
arcseldon / ramdadocs.jpg
Last active February 19, 2016 16:32
Ramda search
Test
@arcseldon
arcseldon / ramda
Created January 28, 2016 17:50 — forked from raine/ramda
Browse Ramda documentation in Terminal
#!/usr/bin/env bash
# Browse Ramda documentation in Terminal
# Requires jq and a tool such as fzf or peco for interactive filtering
LATEST="http://raine.github.io/ramda-json-docs/latest.json"
DOCS_URL="http://ramdajs.com/docs/"
json=$(curl -s $LATEST)
functions=$(echo "$json" | jq -r '.[] | if .sig and (.sig | length > 0) then .name + " :: " + .sig else .name end')
@arcseldon
arcseldon / .eslintrc.js
Created December 19, 2015 10:17 — forked from nkbt/.eslintrc.js
Strict ESLint config for React, ES6 (based on Airbnb Code style)
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"plugins": ["react"],
"ecmaFeatures": {
@arcseldon
arcseldon / gulpfile.js
Created December 16, 2015 12:53 — forked from danharper/gulpfile.js
New ES6 project with Babel, Browserify & Gulp
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var browserify = require('browserify');
var watchify = require('watchify');
var babel = require('babelify');
function compile(watch) {
var bundler = watchify(browserify('./src/index.js', { debug: true }).transform(babel));
// author arcseldon@icloud.com
'use strict';
module.exports = function (req, res, next) {
// we ARE deploying to Heroku. SSL termination happens at the load balancer,
// before encrypted traffic reaches your node app. It is possible to test
// whether https was used to make the request with req.headers['x-forwarded-proto'] === 'https'.
// See SOF answer by arcseldon: http://stackoverflow.com/a/22585754/1882064
if ((req.headers['x-forwarded-proto'] !== 'https') && (process.env.NODE_ENV === 'production')) {
return res.redirect([
@arcseldon
arcseldon / broken.txt
Created October 1, 2014 07:27
Sails - Broken Dependencies
├── async@0.9.0
├─┬ bcrypt@0.8.0
│ ├── bindings@1.0.0
│ └── nan@1.3.0
├─┬ chai@1.9.2
│ ├── assertion-error@1.0.0
│ └─┬ deep-eql@0.1.3
│ └── type-detect@0.1.1
├── chai-as-promised@4.1.1
├── ejs@0.8.8
$ sails lift --verbose
info: Starting app...
verbose: Setting Node environment...
verbose: moduleloader hook loaded successfully.
verbose: Loading app config...
verbose: userconfig hook loaded successfully.
verbose: Exposing global variables... (you can disable this by modifying the properties in `sails.config.globals`)
verbose: logger hook loaded successfully.