In contrast to variables, constants do not change during the execution of a program and are usually declared in all capitals (uppercase), which is a common convention in programming.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Client } from 'pg'; | |
import { PineconeClient } from '@pinecone-database/pinecone'; | |
import Replicate from 'replicate'; | |
// Initialize clients | |
const neonClient = new Client({ | |
connectionString: 'your_neon_connection_string' | |
}); | |
const pinecone = new PineconeClient(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"key": "alt+up", | |
"command": "cursorMove", | |
"when": "textInputFocus", | |
"args": { | |
"to": "up", | |
"by": "line", | |
"value": 2 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First, set your Medium API token (from https://medium.com/me/settings/security if you do have one) | |
TOKEN="your-medium-token" | |
# 1. Get user ID | |
echo "Getting user ID..." | |
USER_INFO=$(curl -X GET "https://api.medium.com/v1/me" \ | |
-H "Authorization: Bearer $TOKEN" \ | |
-H "Content-Type: application/json" \ | |
-H "Accept: application/json" \ | |
-H "Accept-Charset: utf-8") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* (c) 2024 Pierre-Henry Soria. | |
*/ | |
import { StyleSheet, View, ViewStyle, DimensionValue } from 'react-native'; | |
type LineBreakProps = { | |
width?: DimensionValue; | |
color?: string; | |
style?: ViewStyle; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Alias | |
alias vi="nvim" | |
alias c="clear" | |
alias push="git push origin head" | |
alias pull="git pull" | |
alias amend="git amend" | |
alias gi="git" | |
alias g="git" | |
alias gp="git push" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# Convert text to lowercase. | |
## | |
to_lowercase <- function(input_text) { | |
# Check if input is character | |
if (!is.character(input_text)) { | |
stop("Input must be a character string") | |
} | |
# Convert to lowercase |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from PIL import Image, ImageDraw, ImageFont | |
import os | |
def create_terminal_icon(size=512): | |
# Create a new image with transparent background | |
img = Image.new('RGBA', (size, size), (0, 0, 0, 0)) | |
draw = ImageDraw.Draw(img) | |
# Colors |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect, RefObject } from 'react'; | |
/** | |
* Custom hook to handle click outside events for modals and dropdowns | |
* @param ref - Reference to the element to detect clicks outside of | |
* @param handler - Function to call when click outside is detected | |
* @param enabled - Whether the click outside detection is enabled (default: true) | |
*/ | |
export const useClickOutside = ( | |
ref: RefObject<HTMLElement>, |
These are my VSCode extensions. Itβs not a complete list, but chances are youβll find them very handy to have installed.
- GitHub Copilot
- ESLint
- Prettier
- Visual Studio Intellicode (JavaScript/TypeScript)
- ES7+ React/Redux/React-Native snippets https://marketplace.visualstudio.com/items?itemName=dsznajder.es7-react-js-snippets