Skip to content

Instantly share code, notes, and snippets.

View SalahAdDin's full-sized avatar
🎯
Focusing

José Luis SalahAdDin

🎯
Focusing
View GitHub Profile
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
its-tayo / generator.js
Last active August 23, 2023 05:57
Faker.js: Generate array of N items
// generator
const generator = (schema, min = 1, max) => {
max = max || min;
return Array.from({
length: faker.random.number({
min,
max,
}),
}).map(() => {
const innerGen = (anySchema) => Object.keys(anySchema).reduce((entity, key) => {
@obrodinho
obrodinho / README.md
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.

Read https://wiki.archlinux.org/index.php/Microsoft_fonts.

Fastest way, but NOT VERIFIED

https://github.com/fphoenix88888/ttf-mswin10-arch 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
qoomon / conventional_commit_messages.md
Last active April 18, 2024 20:00
Conventional Commit Messages

Conventional Commit Messages

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

Tip

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

Commit Message Formats

Default

@luciddreamz
luciddreamz / keycloak.sh
Last active February 27, 2024 05:26 — forked from paoloantinori/keycloak.sh
Keycloak Admin API Rest Example: Get User
#!/bin/bash
# requires https://stedolan.github.io/jq/download/
# config
KEYCLOAK_URL=http://localhost:8080/auth
KEYCLOAK_REALM=realm
KEYCLOAK_CLIENT_ID=clientId
KEYCLOAK_CLIENT_SECRET=clientSecret
USER_ID=userId
@ThomasG77
ThomasG77 / five-minutes-pgadmin4-desktop-install-guide.md
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
parmentf / GitCommitEmoji.md
Last active April 18, 2024 19:01
Git Commit message Emoji
@barreyro
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…
def CoinDeterminer(num)
return num if num < 5
count = num / 11
if (num%11).even?
return count + 2
else
return count + 1
end
end
@bgrace
bgrace / gist:a5216b4059007924a75c
Last active February 16, 2018 18:35
Mixed navigation menus for Wagtail CMS
# 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
soarez / ca.md
Last active April 15, 2024 12:20
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.