Skip to content

Instantly share code, notes, and snippets.

View mobily's full-sized avatar

Marcin Dziewulski mobily

View GitHub Profile
@DavidWells
DavidWells / github-proxy-client.js
Last active March 3, 2025 17:47
Full Github REST api in 34 lines of code
/* Ultra lightweight Github REST Client */
// original inspiration via https://gist.github.com/v1vendi/75d5e5dad7a2d1ef3fcb48234e4528cb
const token = 'github-token-here'
const githubClient = generateAPI('https://api.github.com', {
headers: {
'User-Agent': 'xyz',
'Authorization': `bearer ${token}`
}
})
@matthewp
matthewp / pnpm-where
Created March 9, 2022 13:49
pnpm-where
#!/bin/bash
bin_name=$1
bin_path="node_modules/.bin/$bin_name"
bin_dir=$(dirname $bin_path)
if [ ! -f "$bin_path" ]; then
echo "$bin_path does not exists"
exit 1
fi
@razor-x
razor-x / apollo-client.ts
Last active December 22, 2022 10:41
AppSync using Apollo Client with subscription support, and custom domain via Lambda@Edge
import type {
NormalizedCacheObject,
PossibleTypesMap,
Resolvers,
TypePolicies
} from '@apollo/client'
import {
ApolloClient as Client,
InMemoryCache,
createHttpLink,
@runiq
runiq / README.md
Last active July 9, 2024 15:35
Neovim throttle & debounce

What are these?

Functions that allow you to call a function not more than once in a given timeframe.

Throttling on the leading edge

This can be illustrated with timing diagrams. In the following diagrams, f designates call to the throttled function, t is the period where the timer is running, and x shows you the actual execution point of the throttled function.

f 1  2  3  4  5  6
@albertogalca
albertogalca / config.yml
Last active January 13, 2023 13:10
Circle CI Config for fastlane
version: 2
aliases:
- &restore_npm_cache
name: 'Restoring node_modules from the cache'
key: yarn-v1-{{ checksum "yarn.lock" }}-{{ arch }}
- &install_npm_dependencies
name: Installing NPM Dependencies
command: yarn install
- &save_npm_cache
@apieceofbart
apieceofbart / test.js
Last active November 4, 2025 09:50
Async testing with jest fake timers and promises
PLEASE CHECK THIS REPO WITH THE EXAMPLES THAT YOU CAN RUN:
https://github.com/apieceofbart/async-testing-with-jest-fake-timers-and-promises
// Let's say you have a function that does some async operation inside setTimeout (think of polling for data)
function runInterval(callback, interval = 1000) {
setInterval(async () => {
const results = await Promise.resolve(42) // this might fetch some data from server
callback(results)
}, interval)
@skarlekar
skarlekar / Start-minio.sh
Last active January 10, 2025 13:09
Raspberry Pi Commands
# Reference: https://github.com/christianbaun/ossperf/wiki/Minio-on-a-Raspberry-Pi-3-with-Raspbian-(Debian-Jessie-8.0)
wget https://dl.minio.io/server/minio/release/linux-arm/minio
chmod +x minio
./minio server --address ":8080" /media/ssd/minio-data/
@huntie
huntie / metro.config.js
Last active July 10, 2023 01:53
Snippets accompanying my article "A concise guide to configuring React Native with Yarn Workspaces" on Medium
/**
* Metro Bundler configuration
* https://facebook.github.io/metro/docs/en/configuration
*
* eslint-env node, es6
*/
const exclusionList = require('metro-config/src/defaults/exclusionList');
const getWorkspaces = require('get-yarn-workspaces');
const path = require('path');
@busypeoples
busypeoples / Stack.re
Created July 20, 2018 09:04
Data Structures in ReasonML: #2 Stack
/* Stack */
/* LIFO: Last In First Out*/
exception Empty;
module type Stack = {
type stack('a) = list('a);
let create: unit => stack('a);
let push: ('a, stack('a)) => stack('a);
let pop: stack('a) => stack('a);
let peak: stack('a) => 'a;
@gkaemmer
gkaemmer / Elixir_Supervision_Trees.md
Last active December 18, 2023 14:37
Quick guide to creating Elixir supervision trees from scratch

Elixir Supervision Trees Made Easy

I started with Elixir just a couple weeks after the switch from 1.4 to 1.5, so the bulk of online resources were out of date (or at least resulted in deprecation warnings). This guide is for defining Elixir 1.5 supervised modules.

It's not actually terribly complicated. It's just sometimes unclear from examples what's implemented by the language and what you actually have to implement yourself.

Say we want a supervision tree like this (where each atom is a process):

    :a

/ \