Skip to content

Instantly share code, notes, and snippets.

View nabilfreeman's full-sized avatar
🤗
hello wrold

Nabs nabilfreeman

🤗
hello wrold
View GitHub Profile
@nabilfreeman
nabilfreeman / .cursorrules
Last active February 27, 2025 12:51
My Global Cursor "User Rules"
Howdy partner! You are an expert level JavaScript developer. Please stick to the following the best practices in your work:
- When you write a function, please always add detailed JSDoc and as many inline comments as appropriate to help other developers understand what the function is doing. JSDoc should go directly above the line where the function is defined. The imports do not need documentation.
- Line spacing between different concerns, whether it is in a function, a component or an API route, is always encouraged to improve readability.
- Similarly, the solution implemented should favour readability over succinctness or performance, unless it is specifically requested or you feel it is necessary to avoid critical performance issues.
- When dealing with loops, please use for(... of ...) instead of forEach as much as possible. Also, please try to avoid reduce when accumulating data and instead use a for loop in conjunction with a local array or variable. filter and map chaining is acceptable and encourag
@nabilfreeman
nabilfreeman / non-hooks-react-native-stripe-terminal.ts
Created June 12, 2024 22:13
A non-hooks implementation of @stripe/stripe-react-native-terminal. Extremely cursed. This is a proof of concept why you should not do things this way.
import {
cancelDiscovering,
discoverReaders,
initialize,
setConnectionToken,
} from '@stripe/stripe-terminal-react-native/src/functions';
import {
reportProblemSilently,
showSeriousProblem,
} from '../../util/errorHandling';
@nabilfreeman
nabilfreeman / quora-auth-wall-ublock-origin
Created February 28, 2022 00:29
Stops blur overlay on Quora. Go to: uBlock origin -> Settings -> My Filters -> (paste this in)
! 2022-02-28 https://www.quora.com
www.quora.com##[class*="blocking_wall"]
www.quora.com##*:style(filter: none !important)
www.quora.com##.qu-overflow--hidden:style(overflow:auto!important)
@nabilfreeman
nabilfreeman / migrate-postgres-database-sql.md
Last active February 11, 2022 18:45
How to migrate a Postgres database

How to migrate Postgres database

You have two options:

  • Dumpfile
  • SQL

Dumpfile is totally headless and can be done by the CLI unattended using pg_dump and pg_restore. However, it is a binary file so you cannot make any adjustments to the contents between dump and restore.

SQL outputs a massive INSERT script that allows you to see what is going on, and make any syntax changes that might be needed if your Postgres versions are different. Since it does not use pg_restore, you need to manually respond to a password prompt via psql if you go this way.

@nabilfreeman
nabilfreeman / lesalon-eslint-config.js
Created August 18, 2021 10:40
LeSalon's eslint config
const IGNORE = 0;
const WARN = 1;
const ERROR = 2;
module.exports = {
root: true,
"extends": "airbnb",
"parser": "babel-eslint",
"rules": {
"import/no-named-as-default-member": IGNORE,
@nabilfreeman
nabilfreeman / ccdl.command
Created February 15, 2021 12:56 — forked from ayyybe/ccdl.command
Adobe Offline Package Generator v0.1.2 (macOS only)
#!/bin/bash
CYAN="$(tput bold; tput setaf 6)"
RESET="$(tput sgr0)"
clear
if command -v python3 > /dev/null 2>&1; then
if [ $(python3 -c "print('ye')") = "ye" ]; then
clear
@nabilfreeman
nabilfreeman / gist:d4af1b7be7291baec5be44aae69806d4
Last active November 9, 2020 10:26
How to delete things from /usr/bin
# In macOS Catalina onwards `/usr/bin` is protected. Before you would only need to run a root shell to make any changes. Now there is something extra to do.
# Let's say I want to run this command:
# sudo rm -rf /usr/bin/python3
# Deleting something will give you the error:
# rm: /usr/bin/python3: Read-only file system
# To get around this you need to first run:
@nabilfreeman
nabilfreeman / pizzly.js
Last active June 29, 2020 13:41
Pizzly Node.js integration using Axios and environment variables (2 examples: Xero and Trello)
const Axios = require('axios');
const {
PIZZLY_URL,
PIZZLY_SECRET_KEY,
PIZZLY_TRELLO_ID,
PIZZLY_XERO_ID,
} = process.env;
const integrations = {
@nabilfreeman
nabilfreeman / copyToFat32.sh
Last active May 9, 2023 00:38
FAT32 File copier & splitter (works with Multiman)
#!/bin/bash
# Are you using Mac OS X?
# You need to install coreutils for this to work.
# try `brew install coreutils`
# or `sudo port install coreutils`
# set a part size that works with FAT32 drives
PART_SIZE=3999
# nice little intro
@nabilfreeman
nabilfreeman / copyToFat32.sh
Created November 8, 2018 12:18
FAT32 File copier & splitter (works with Multiman)
#!/bin/bash
# Are you using Mac OS X?
# You probably need to install a newer version of split for this to work.
# try `brew install coreutils`
# or `sudo port install coreutils`
# set a part size that works with FAT32 drives
PART_SIZE=3999
# nice little intro