Skip to content

Instantly share code, notes, and snippets.

View anthony2025's full-sized avatar
🛵

Anthony Ascencio anthony2025

🛵
View GitHub Profile
@anthony2025
anthony2025 / tapAndLog.js
Created June 5, 2018 17:40
for use inside compose/flow statements, logs without disrupting the data flow
// for use inside compose/flow statements, logs without disrupting the data flow
export const tapAndLog = <T>(data: T): T => console.log('tapped', data) || data; // eslint-disable-line no-console
@anthony2025
anthony2025 / mapObject.js
Created June 5, 2018 17:37
provides us a map with a (value, key, index) inner function signature
export const mapObject = R.addIndex(R.map);
@anthony2025
anthony2025 / conditional.js
Created June 5, 2018 17:35
for use inside compose/flow statements, branches based on a 'predicate' (more precisely just a boolean value)
export const conditional = <T>(predicate: boolean, ifTrue: T => *, ifFalse: T => *) =>
(value: T) => predicate ? ifTrue(value) : ifFalse(value);
@anthony2025
anthony2025 / Link.js
Last active June 1, 2018 01:06
React-Router Link that handles falsy 'to' props and mailto links
const unix_timestamp = js_timestamp/1000|0;
const percentChance = (probability) => Math.random() <= probability
if (percentChance(0.95)) doSomething()
@anthony2025
anthony2025 / uncappedMap.js
Created April 26, 2018 19:15
provides us a fp.map with a (value, key, index) signature, super useful for objects
import fp from 'lodash/fp';
const uncappedMap = fp.map.convert({ cap: false });
import fp from 'lodash/fp';
const uncappedMap = fp.map.convert({ cap: false });
[ignore]
[include]
./src/
[libs]
[lints]
[options]
# to encrypt:
openssl enc -in ./auth.json -aes-256-cbc -pass file:./password -out auth.json.encrypted
# to decrypt:
openssl enc -d -in ./auth.json.encrypted -aes-256-cbc -pass file:./password -out auth.json