Skip to content

Instantly share code, notes, and snippets.

View bijoythomas's full-sized avatar

Bijoy Thomas bijoythomas

View GitHub Profile
@bijoythomas
bijoythomas / add-ramdafns-to-sublime-autocomplete-hints.js
Last active January 16, 2018 15:21
Generate ramda.sublime-completions
let R = require('ramda')
let filecontent = R.compose(
JSON.stringify,
R.assoc('scope', 'source.js'),
R.flip(R.assoc('completions'))({}),
R.map(R.converge(R.merge, [R.flip(R.assoc('trigger'))({}), R.flip(R.assoc('content'))({})])),
R.keys
)(R)
@bijoythomas
bijoythomas / add-sanctuaryfns-to-sublime-autocomplete-hints.js
Created March 21, 2019 23:51
Sanctuary functions in Sublime autocomplete
let S = require('sanctuary')
let R = require('ramda')
let filecontent = R.compose(
JSON.stringify,
R.assoc('scope', 'source.js'),
R.flip(R.assoc('completions'))({}),
R.map(R.converge(R.merge, [R.flip(R.assoc('trigger'))({}), R.flip(R.assoc('content'))({})])),
R.keys
)(S)
@bijoythomas
bijoythomas / funpy.py
Last active March 17, 2020 15:47
Ramda like functions for Python
import re
from fn import F, recur
from datetime import datetime
from funcy import mapcat, walk_values, merge as funcymerge, group_by
# basic combinators
I = F(lambda x: x) # identity
K = F(lambda x: F(lambda y: x)) # constant
T = F(lambda x: F(lambda f: f(x))) # thrush
A = F(lambda f: F(lambda x: f(x))) # apply
@bijoythomas
bijoythomas / trampoline.js
Last active March 18, 2020 20:59
Trampolining TCO functions in JS examples
/*
* aperture function modelled after https://ramdajs.com/docs/#aperture
*/
const head = xs => xs[0]
const last = xs => xs[xs.length - 1]
const tail = xs => xs.slice(1)
const isEmpty = xs => xs.length == 0
/* A recursive aperture implementation
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.