Skip to content

Instantly share code, notes, and snippets.

View bennidi's full-sized avatar

Benjamin Diedrichsen bennidi

View GitHub Profile
@axeldelafosse
axeldelafosse / react-native-mmkv-plugin.js
Last active October 12, 2023 19:57
[DEPRECATED] React Native MMKV - Config plugin for Expo. You need to use "react-native-mmkv": "^1.6.2"
// DEPRECATED
const {
withDangerousMod,
WarningAggregator,
AndroidConfig,
withAppBuildGradle,
} = require("@expo/config-plugins");
const path = require("path");
const fs = require("fs");
@jbaranski
jbaranski / SelfHostOpenStreetMapDocker.md
Created August 1, 2020 14:52
How to self host an Open Street Map server (using Docker)

Here are the steps needed to run a self hosted Open Street Map server (using Docker):

  1. Download desired pbf files (like south-carolina-latest.osm.pbf) from https://download.geofabrik.de or just use the following empty planet below:

    
      <?xml version='1.0' encoding='UTF-8'?>
      <osm version="0.6" generator="osmconvert 0.8.8" timestamp="2019-10-23T20:18:02Z">
        <bounds minlat="42.4276" minlon="1.412368" maxlat="42.65717" maxlon="1.787481"/>
      </osm>
    
@GavinRay97
GavinRay97 / index.md
Last active April 12, 2024 18:31
Hasura organization permissions

Introduction

This document outlines how to model a common organization-based permission system in Hasura. Let's assume that you have some table structure like the following:

Table Name Columns Foreign Keys
User id, name, email
Organization User id, user_id, organization_id user_id -> user.id, organization_id -> organization.id
Organization id, name
@goloroden
goloroden / app.js
Last active June 22, 2023 02:10
Async constructors for JavaScript
// In JavaScript, constructors can only be synchronous right now. This makes sense
// from the point of view that a constructor is a function that returns a newly
// initialized object.
//
// On the other hand, it would sometimes be very handy, if one could have async
// constructors, e.g. when a class represents a database connection, and it is
// desired to establish the connection when you create a new instance.
//
// I know that there have been discussions on this on StackOverflow & co., but
// the so-far mentioned counter arguments (such as: doesn't work as expected
@joffilyfe
joffilyfe / README.md
Last active April 3, 2023 01:38
GITEA + Drone (0.7|0.8)

Compose file to setup and host a Gitea and Drone environment

This environment is dependent off a common network for docker/git plugin and gitea-server, so for this work fine in closed networks we have to create a custom network before run this composefile.

First create your network:

docker network create gitea-network
@duluca
duluca / npm-scripts-for-docker.md
Last active August 19, 2024 09:22
npm scripts for Docker

These are generic npm scripts that you can copy & paste into your package.json file as-is and get access to convinience scripts to manage your Docker images all in one place.

How to Use

npm i -g mrm-task-npm-docker
npx mrm npm-docker

Contribute

Here's the code repository https://github.com/expertly-simple/mrm-task-npm-docker

@StevenACoffman
StevenACoffman / _MicroService Proxy Gateway Solutions.md
Last active July 15, 2024 05:12
Microservice Proxy/Gateway Solutions

MicroService Proxy Gateway Solutions

Kong, Traefik, Caddy, Linkerd, Fabio, Vulcand, and Netflix Zuul seem to be the most common in microservice proxy/gateway solutions. Kubernetes Ingress is often a simple Ngnix, which is difficult to separate the popularity from other things.

Github Star Trend:

Github Star History for Kong vs traefik vs fabio vs caddy vs Zuul

This is just a picture of this link from March 2, 2019

Originally, I had included some other solution

@JorgeCastilloPrz
JorgeCastilloPrz / memoize.kt
Last active March 2, 2018 08:53
kotlinmemoize for a friend
class Memoize1<in T, out R>(val f: (T) -> R) : (T) -> R {
private val values = mutableMapOf<T, R>()
override fun invoke(x: T): R {
return values.getOrPut(x, { f(x) })
}
}
fun <T, R> ((T) -> R).memoize(): (T) -> R = Memoize1(this)
val memoizedSumFactors = { x: Int -> sumOfFactors(x) }.memoize()
@neunhoef
neunhoef / docker-compose.yml
Created December 7, 2016 11:08
Docker compose file to start a local arangodb cluster
version: '2'
services:
agency:
image: arangodb/arangodb
environment:
- ARANGO_NO_AUTH=1
command: arangod --server.endpoint tcp://0.0.0.0:5001 --server.authentication false --agency.activate true --agency.size 1 --agency.supervision true --database.directory /var/lib/arangodb3/agency1
coordinator:
image: arangodb/arangodb
@mmazzarolo
mmazzarolo / hideOnScroll.js
Last active July 4, 2024 12:57
react-native-action-button hide on scroll
// 1. Define a state variable for showing/hiding the action-button
state = {
isActionButtonVisible: true
}
// 2. Define a variable that will keep track of the current scroll position
_listViewOffset = 0
// 3. Add an onScroll listener to your listview/scrollview
<ListView