I hereby claim:
- I am kalisjoshua on github.
- I am kalisjoshua (https://keybase.io/kalisjoshua) on keybase.
- I have a public key ASB0fmsuRsLx_spNBDE-j91MEdsUorgmX0BtdT20cWEybgo
To claim this, I am signing this object:
const fs = require('fs') | |
const file = './audit.log' | |
const start = (q) => /^┌[─]+┬[─]+┐$/.test(q) | |
const split = (q) => /^├[─]+┼[─]+┤$/.test(q) | |
const close = (q) => /^└[─]+┴[─]+┘$/.test(q) | |
const audit = fs.readFileSync(file, 'utf-8') | |
.split(/\n/g) |
I hereby claim:
To claim this, I am signing this object:
standardDELETE: | |
responses: | |
200: | |
description: <<200description>> | |
body: | |
application/json: | |
example: <<200jsonExample>> | |
schema: <<200jsonSchema>> | |
202: | |
description: <<202description>> |
const compose = (...fns) => | |
fns.reduceRight((g, f) => (...args) => f(g(...args))) |
const curry = (fn, ...args) => args.length < fn.length | |
? (...add) => curry(fn, ...args.concat(add)) | |
: fn(...args) |
// 1. | |
// replace instances with different replacement strings | |
const qwerty = 'qw#rt#'.replace(/#/g, [].shift.bind(['e', 'y'])); | |
// 2. | |
// make Array.slice available as a function instead of a method | |
const slice = Function.prototype.call.bind(Array.prototype.slice); | |
// 3. | |
// ASI (failure) working in conjunction with the comma operator |
#! /bin/bash | |
ROOT=/opt/fact | |
FACTORIO="$ROOT/factorio/bin/x64/factorio" | |
VERSION=$($FACTORIO --version | xargs echo | cut -d ' ' -f 2) | |
if [ "$1" = "start" ]; then | |
echo 'starting server' | |
# echo $$ > $ROOT/factorio.pid |
function pubsubFactory() { | |
let subscribers = []; | |
const pub = publish; | |
const sub = subscribe; | |
const remove = unsubscribe; | |
function publish(message) { | |
if (!message) { | |
throw new Error('Not going to publish an empty message to subscribers.', 'pubsub.js'); | |
} |
I don't know why, but this morning I felt like exploring function curry-ing and writing a little bit about it. First I watched a video on curry-ing from the JS Weekly newletter. Then I wanted to write my own implementation. After that I thought I would share what I did with my team at work and then this.
Brain-dump over.
The only reason I created two different implementations is becuase semantically I think that a function is only curried once; as I understand it - to curry - is a process by which you convert a single function which takes multiple arguments into a series of multiple functions each taking exactly one argument.
So, while the implementations work identically from the point of view of the user the differ in their implementation; basically only semantically.
angular.module('app') | |
.directive('dynamicFields', function () { | |
return { | |
link: function ($scope) { | |
// this hack brought to you by kalisjoshua; plenty of searching | |
// and one big guess that this might work, only time will tell | |
$scope.validation[$scope.name] = $scope.validation['{{name}}']; | |
}, | |
scope: { | |
name: '@', |