Skip to content

Instantly share code, notes, and snippets.

@ali-aka-ahmed
ali-aka-ahmed / backend-setup.md
Created August 30, 2024 01:47
Backend Setup Instructions

Backend Setup Instructions

Use this guide to setup the backend for this project.

It uses Supabase, Drizzle ORM, and Server Actions.

Write the complete code for every step. Do not get lazy. Write everything that is needed.

Your goal is to completely finish the backend setup.

@ali-aka-ahmed
ali-aka-ahmed / searchEdgeCases.js
Created September 2, 2022 18:58
Edge cases when learning about 'search' functions within array operations
/*
* =============================================
* =========== SEARCH EDGE CASES ===============
* =============================================
*/
// NOT IN LIST
const listOfDogs = ["pomeranian", "shih tzu"];
@ali-aka-ahmed
ali-aka-ahmed / arrayOperations.js
Last active September 2, 2022 18:59
Common operations on arrays
/*
* =================================
* =========== SEARCH ==============
* =================================
*/
let array = [1, 2, 3, 4, 5]
let val = array.find((val) => {
if (val === 1) {
@ali-aka-ahmed
ali-aka-ahmed / findLongestWord.js
Last active September 2, 2022 19:00
Ways to think through writing this function!
// Standard Solution
function findLongestWord(word1, word2, word3) {
if ((word1.length >= word2.length) && (word1.length >= word3.length)) {
return word1
} else if ((word2.length >= word3.length) && (word2.length >= word1.length)) {
return word2
} else if ((word3.length >= word1.length) && (word3.length >= word2.length)) {
return word3;
} else {
return 'error';
@ali-aka-ahmed
ali-aka-ahmed / wttrin.sh
Last active April 14, 2022 21:38
wttr.in shell function for .zshrc/.bashrc
weather() {
# Handle our variables
# If no arg is given, default to San Francisco
local request curlArgs
curlArgs="-H \"Accept-Language: ${LANG%_*}\" --compressed -m 10"
case "${1}" in
(-h|--help) request="wttr.in/:help" ;;
(*) request="wttr.in/${*:-SanFrancisco}?u" ;;
esac