Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

José Luis SalahAdDin

🎯
Focusing
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
its-tayo / generator.js
Last active January 23, 2023 10:12
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({
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
View README.md

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 February 9, 2023 04:02
Conventional Commit Messages
View conventional_commit_messages.md

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

Default

@luciddreamz
luciddreamz / keycloak.sh
Last active February 1, 2023 10:28 — forked from paoloantinori/keycloak.sh
Keycloak Admin API Rest Example: Get User
View keycloak.sh
#!/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 October 28, 2021 12:36
5 minutes PgAdmin4 Desktop install guide
View five-minutes-pgadmin4-desktop-install-guide.md

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 February 9, 2023 04:24
Git Commit message Emoji
View GitCommitEmoji.md
@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…
View Coin Determiner
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
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
soarez / ca.md
Last active February 8, 2023 02:18
How to setup your own CA with OpenSSL
View ca.md

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.