Skip to content

Instantly share code, notes, and snippets.

View SalahAdDin's full-sized avatar

José Luis SalahAdDin

View GitHub Profile
View useTracking.ts
import {useEffect, useState} from 'react';
import {Alert} from 'react-native';
import BackgroundGeolocation from '@mauron85/react-native-background-geolocation';
import {defaultLocation} from '../utils/vars';
import {getDistanceFromLatLonInKm} from '../utils/getDistance';
const useTracking = (isActive: boolean) => {
const [location, setLocation] = useState(defaultLocation);
const [history, setHistory] = useState<any>([]);
const [distance, setDistance] = useState<number>(0);
its-tayo / generator.js
Last active August 23, 2023 05:57
Faker.js: Generate array of N items
View generator.js
// generator
const generator = (schema, min = 1, max) => {
max = max || min;
return Array.from({
length: faker.random.number({
}).map(() => {
const innerGen = (anySchema) => Object.keys(anySchema).reduce((entity, key) => {
obrodinho /
Created February 12, 2019 14:56
[Arch] Install TTF Fonts from Windows 10

Micro Intro

Arch is great and its wiki covers most use cases. This is just a reminder that what works and which newbie tricks are required to get and install these fonts.


Fastest way, but NOT VERIFIED This package holds all files nedded to install win10 ms fonts. These are just the pacman-cache-install-ready-sort-of-a-files. They are in the form of: ttf-ms-win10-10.0.17763.1-1-any.pkg.tar.xz, and they are the result of a succesful makepkg

qoomon /
Last active December 4, 2023 04:46
Conventional Commit Messages

Conventional Commit Messages

See how a minor change to your commit message style can make a difference. Examples

Have a look at CLI util git-conventional-commits to ensure this conventions and generate changelogs

Commit Formats


luciddreamz /
Last active August 9, 2023 13:48 — forked from paoloantinori/
Keycloak Admin API Rest Example: Get User
# requires
# config
ThomasG77 /
Last active May 21, 2023 09:51
5 minutes PgAdmin4 Desktop install guide

5 minutes PgAdmin4 Desktop install guide

Done on Linux (Ubuntu tested)

Virtualenv & install of Python package & its deps

cd $HOME
virtualenv --python=/usr/bin/python2.7 pgadmin4
source pgadmin4/bin/activate
parmentf /
Last active December 4, 2023 07:52
Git Commit message Emoji
barreyro / Coin Determiner
Created May 23, 2015 23:25
Have the function CoinDeterminer(num) take the input, which will be an integer ranging from 1 to 250, and return an integer output that will specify the least number of coins, that when added, equal the input integer. Coins are based on a system as follows: there are coins representing the integers 1, 5, 7, 9, and 11. So for example: if num is 1…
View Coin Determiner
def CoinDeterminer(num)
return num if num < 5
count = num / 11
if (num%11).even?
return count + 2
return count + 1
bgrace / gist:a5216b4059007924a75c
Last active February 16, 2018 18:35
Mixed navigation menus for Wagtail CMS
View gist:a5216b4059007924a75c
# Notes:
# Python 3 assumed, but shouldn't be hard to backport to Python 2
# Cobbled together from two slightly different implementations, sorry for any inconsistencies.
# This creates two models, NavigationMenu, and NavigationMenuItem. A site can have many NavigationMenus, which are referenced from
# the template by location. E.g., 'footer', 'left_nav'. You can also create single-item lists for special purpose links/buttons,
# such a privacy_policy or homepage_cta. This helps to reduce hard coding in templates.
# NavigationMenuItem mixes in some different link types (Page, Document, URL) and presents them in a consistent way. It provides
# the ability to override the title of the referenced object.
soarez /
Last active November 29, 2023 13:29
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.