I hereby claim:
- I am asapien on github.
- I am sapienz (https://keybase.io/sapienz) on keybase.
- I have a public key ASDqalDydfkpzj6b7eR9ndIeP288fvART4m63ZnIB65s0Ao
To claim this, I am signing this object:
var mat = [ | |
[1, 2, 3, 4], | |
[5, 6, 7, 8], | |
[9, 10, 11, 12], | |
[13, 14, 15, 16] | |
]; | |
var DIRECTIONS = { | |
FORWARD: 1, | |
BACKWARD: -1 |
function compose(func, ...funcs) { | |
return function(...args) { | |
return funcs.length > 0 | |
? compose(...funcs)(func(...args)) | |
: func(...args) | |
} | |
} | |
// Or, in a more compact version: | |
const compose = (func, ...funcs) => (...args) => |
I hereby claim:
To claim this, I am signing this object:
### Feature development Planning Workflow<sup>Functional approach</sup> | |
In FP, impurity (aka Effects), is handled in a Monadic approach. | |
This approach enables developers to focus on pure logic implementation and testing, keeping the "Side Effects" on the envelope. | |
I would like to give a shot to this approach to development planning and time estimations. | |
The software we are developing is ususlly not self contained. We need to integrate with other software, APIs, Operating Systems, etc... | |
All those "effectful" aspects, in practice, take an *unknown* amount of time to complete. | |
This makes our estimation prone to errors, too "flexible" or unprecise, or in some cases "way off". |
export const parallel = (...fs) => sequential( | |
() => fs.map(f => f()), | |
Promise.all.bind(Promise)); | |
export const sequential = (f, ...fs) => val => Promise.resolve() | |
.then(() => f(val)) | |
.then(fs.length ? sequential(...fs) : id => id); |
When working on a monorepo, we often create uncommitted changes in multiple "subrepos", which turns into a mess when preparing a commit, when pulling changes from remote, etc...
Git allows us to create a sparse-clone
of the monorepo, containing only the subrepo that we are interested in, yet keeping the integrity and functions of a VCS.
For example, we have a monorepo with the following structure (computer@user:~$ tree monorepo
):
// version 1 | |
z = (k, a, b, c) => ( | |
i = r => k in r[0] ? r[0][k] : r[1], | |
d = j => Intl.DateTimeFormat('en', { month: 'long' }).format(new Date().setMonth(j)), | |
f = [[...[,,,,].fill(0.1) ,3.6], 1], | |
g = [[1,10,5,9,7,3,7,8], 6], | |
h = [[1,1,2,2,2,2,5,3,3,1], k % 2], | |
`\nJDK ${ a.toFixed(k > 4 ? 0 : 1) } ${k < 11 ? 'was' : 'will be' } released in ${d(b)} ${c}` + (41 < k ? '' : z(k+1, a + i(f), b + i(g), c + i(h))) | |
) |
Homebrew build logs for octave on macOS 10.13.6 | |
Build date: 2018-08-11 19:46:09 |
import scalaz.zio._ | |
trait Tap[-E1, +E2] { | |
def apply[R, E >: E2 <: E1, A](effect: ZIO[R, E, A]): ZIO[R, E, A] | |
} | |
object Tap { | |
type Percentage = Int | |
def make[E1, E2](errBound: Percentage, |
import _ from 'lodash' | |
// accumulator, value, key, object) | |
export const transformDeep = (root: object, iteratee: (accumulator: object, nodeOrLeaf: any, key: string, parent: object) => void): object => { | |
const deepIteratee = (deepAccumulator: object, deepNodeOrLeaf: any, deepKey: string, deepParent: object): void => { | |
iteratee(deepAccumulator, deepNodeOrLeaf, deepKey, deepParent) //run potential mutation | |
if (_.isPlainObject(deepNodeOrLeaf) || _.isArray(deepNodeOrLeaf)) { // run deep (maybe shouldRunDeep with eq check?) |