Skip to content

Instantly share code, notes, and snippets.

Avatar
🟨
getting things done 💪🏻

Stefan Natter natterstefan

🟨
getting things done 💪🏻
View GitHub Profile
@natterstefan
natterstefan / password_autofill_expo_how_to.md
Created March 18, 2020 20:10 — forked from amcvitty/password_autofill_expo_how_to.md
Configure Password Autofill on a React Native Expo app
View password_autofill_expo_how_to.md

Password Autofill on a React Native Expo app

Developing an app to accompany our website, worried that we would lose people in the transition if they couldn't remember their password, we were looking to make our app do Password AutoFill, a feature in iOS.

A talk from WWDC introducing the feature: https://developer.apple.com/videos/play/wwdc2017/206/

It works well, but there were a few bumps in the road making it work for React Native on Expo, so here are some notes to help out.

Apple's docs are here: https://developer.apple.com/documentation/security/password_autofill and they say something like this:

@natterstefan
natterstefan / HTMLToReact.tsx
Last active July 5, 2023 08:42
html-react-parser | TypeScript solution
View HTMLToReact.tsx
/**
* Works in Next.js 10.x
*/
import React from 'react'
import parse, {
domToReact,
attributesToProps,
Element,
HTMLReactParserOptions,
} from 'html-react-parser'
@natterstefan
natterstefan / README.md
Created February 18, 2020 14:47
Jest | Mock useState
View README.md

Jest - mock useState

When using import React, { useState } from 'react' in your components, this is how you can mock useState with jest.

@natterstefan
natterstefan / moveMouse.js
Created April 27, 2023 19:40
JS Utils | Move Mouse Randomly Forever
View moveMouse.js
// function to generate a random number within a range
function getRandomNumber(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
// function to generate a random mouse coordinate within the viewport
function getRandomCoordinate() {
const x = getRandomNumber(0, window.innerWidth);
const y = getRandomNumber(0, window.innerHeight);
return { x, y };
@natterstefan
natterstefan / README.md
Last active March 2, 2023 19:43
NODE | macOS fix node-gyp
@natterstefan
natterstefan / setup.sh
Last active January 9, 2023 04:25
Raspberry Pi | Setup gdrive to sync local folder to Google Drive
View setup.sh
#!/bin/bash
# gdrive client: https://github.com/gdrive-org/gdrive
# inspired by https://github.com/gdrive-org/gdrive/issues/205#issuecomment-423759052
# Create directory ~/backups (must be empty at the beginning)
rm -rf ~/backups && mkdir ~/backups
# upload it the first time into a parent directory
# 1234 => id of the parent directory on google drive
# eg. https://drive.google.com/drive/u/0/folders/1234
@natterstefan
natterstefan / backup.sh
Created May 1, 2019 05:41
Raspberry Pi | Backup and Sync Pi-hole and UniFi data from a Raspberry Pi to Google Drive
View backup.sh
#!/bin/bash
# create backup folders (if they do not exist yet)
mkdir -p ~/backups
mkdir -p ~/backups/unifi
mkdir -p ~/backups/pihole
# backup pi-hole
(cd ~/backups/pihole && pihole -a teleporter)
@natterstefan
natterstefan / README.md
Last active November 30, 2022 14:57
Typescript | Infere Types from PropTypes
@natterstefan
natterstefan / README.md
Last active September 23, 2022 02:42
Storybook | Tailwind in Next.js App with Webpack@5
View README.md