Skip to content

Instantly share code, notes, and snippets.


Karolis Narkevicius KidkArolis

View GitHub Profile
View addParamsForward.js
Install this hook in app.hooks.js
module.exports = app => {
before: {
all: [
KidkArolis /
Last active Mar 16, 2020
Feedback on `useMutableSource`

Dear reader,

In the last few years, I've been using my own global store implementation with great success (yes, I'm aware there exist a bazillion "redux like" stores). My one's called tiny-atom.

In particular, the following 4 requirements for a global store emerged from my needs:

1. Batch multiple, rapid store changes

For example, tiny-atom uses requestAnimationFrame to delay/batch the re-renders.

KidkArolis / feathers.js
Created Nov 20, 2019
Feathers Client with robust reauthentication
View feathers.js
import createFeathersClient from '@feathersjs/feathers'
import auth from '@feathersjs/authentication-client'
import socketio from '@feathersjs/socketio-client'
import io from ''
export function createFeathers() {
const socket = io()
const feathers = createFeathersClient()
KidkArolis /
Last active Nov 17, 2020
Designing custom React hooks - sequencing of async effects

We've been building a hooks based REST API wrapper.

A specific use case discussed in this gist is – how do you close a modal after updating a remote resource completes succesfully?

Which of the following options seems best or is there a better approach altogether?

1. Async/Await

function EditNoteModal ({ id, onClose }) {
KidkArolis / default.yml
Created Feb 9, 2019
node-config example
View default.yml
port: 3000
secret: abc
protocol: http
host: localhost:3000
clientId: a
clientSecret: b
KidkArolis / Dockerfile
Last active Dec 13, 2018
Countly on DigitalOcean
View Dockerfile
FROM countly/countly-server
KidkArolis / actions.js
Created Nov 21, 2018
Fetch and take latest
View actions.js
import axios from 'axios'
import fetch from './fetch'
export default {
async fetchPage ({ dispatch }, { query, headers }, ref) {
// every time this action is dispatched, make the request using the fetch helper
// which ensures we cancel previous requests and only mutate state after the latest one
await fetch(ref, {
request: cancelToken => {
return Promise.all(
View gist:b6861b42ddf3a84564577fc166a09e09
Description=Playe Controller
ExecStart=/usr/bin/node /home/pi/play/play-controller/controller.js
View close.js
'use strict'
let express = require('express')
let axios = require('axios')
let server
function once (cb) {
let app = express()
app.get('/foo', (req, res, next) => {
View karma.conf.js
var grep = require('karma-webpack-grep')
var webpackConfig = require('./webpack.config')
module.exports = function (config) {
webpackConfig.plugins = (webpackConfig.plugins || []).concat(grep({
grep: config.grep,
basePath: '.',
testContext: './tests'