Skip to content

Instantly share code, notes, and snippets.

View mk0y's full-sized avatar

Marko Jakic mk0y

View GitHub Profile
const asyncCompose = (...fns) => input =>
fns.reduceRight(
(chain, fn) => chain.then(fn),
Promise.resolve(input)
)
// import { authService } from 'authservice'
const authService = null
const getUser = async ({ auth = authService, ...dependencies }) => {
try {
@mk0y
mk0y / lens.js
Created June 9, 2020 12:21 — forked from leihuang23/lens.js
Lens implementation in JavaScript
const curry = fn => (...args) =>
args.length >= fn.length ? fn(...args) : curry(fn.bind(undefined, ...args))
const always = a => b => a
const compose = (...fns) => args => fns.reduceRight((x, f) => f(x), args)
const getFunctor = x =>
Object.freeze({
value: x,
@mk0y
mk0y / register-schema.py
Created July 9, 2019 08:04
Register AVRO schema
#!/usr/bin/env python
import os
import sys
import requests
schema_registry_url = sys.argv[1]
topic = sys.argv[2]
schema_file = sys.argv[3]

Folder Structure

Motivations

  • Clear feature ownership
  • Module usage predictibility (refactoring, maintainence, you know what's shared, what's not, prevents accidental regressions, avoids huge directories of not-actually-reusable modules, etc)
@mk0y
mk0y / gist:1572421775afbbb03602
Last active November 26, 2015 10:21
set vim to find ctags file up through project hierarchy
:set autochdir
set tags=tags;/
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^intake.php$ controlpanel.php?category=Intake [NC,QSA]
RewriteRule ^new.php$ controlpanel.php?category=Intake [NC,QSA]
RewriteRule ^yes.php$ controlpanel.php?category=Yes [NC,QSA]
RewriteRule ^active.php$ controlpanel.php?category=Active [NC,QSA]
RewriteRule ^producers.php$ controlpanel.php?category=Producers [NC,QSA]
@mk0y
mk0y / sample.dynamodb.php
Created June 12, 2012 11:35
DynamoDB example
require_once dirname(__FILE__) . '/sdk-1.5.6.2/sdk.class.php';
$dynamodb = new AmazonDynamoDB();
// set closest region
$dynamodb->set_hostname("http://dynamodb.eu-west-1.amazonaws.com");
// Name for your table
$table_name = "ObjectsTest";
// This is how they suggest to initialize the table
do {