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 { NextApiRequest, NextApiResponse } from 'next'; | |
| export type CustomField = { | |
| name: string; | |
| value: string; | |
| }; | |
| export type SubscriptionTier = 'free' | 'premium'; | |
| export type SubscriptionInput = { |
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
| "use client"; | |
| import React, { useState, useEffect } from "react"; | |
| import { | |
| useQuery, | |
| useMutation, | |
| useQueryClient, | |
| QueryClient, | |
| QueryClientProvider, | |
| } from "@tanstack/react-query"; |
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
| # Path to the ASCII art file | |
| moose="$HOME/moose.txt" | |
| # Display the ASCII art at the top of the terminal | |
| if [ -f "$moose" ]; then | |
| cat "$moose" | |
| fi | |
| # Display the moose at will | |
| alias moose="cat $HOME/moose.txt" |
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 { createContext, useContext, useState, useEffect } from 'react'; | |
| const LogContext = createContext(); | |
| export const LogProvider = ({ children }) => { | |
| const [logs, setLogs] = useState([]); | |
| useEffect(() => { | |
| const interval = setInterval(() => { | |
| if (logs.length > 0) { |
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
| function rgbToHex(r, g, b) { | |
| return "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1).toUpperCase(); | |
| } | |
| function getContrastRatio(color1, color2) { | |
| const luminance1 = chroma(color1).luminance(); | |
| const luminance2 = chroma(color2).luminance(); | |
| return (Math.max(luminance1, luminance2) + 0.05) / (Math.min(luminance1, luminance2) + 0.05); | |
| } |
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
| const fs = require('fs'); | |
| const path = require('path'); | |
| const childProcess = require('child_process'); | |
| const readline = require('readline'); | |
| const RESTART_DELAY = 1800; // dedup events | |
| const MAIN_PROCESS_FILE = 'index.js'; | |
| function logts(date = new Date()) { | |
| const year = date.getFullYear(); |
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
| #!bin/zsh | |
| # Example Usage: pkill 3000 | |
| # Kills all processes listening on the specified port | |
| pkill () { | |
| sudo lsof -i :$1 | # get a list of all processes listening on the specified port | |
| xargs -I % echo % | # convert the list into a string | |
| awk '{print $2}' | # select only the PID column (2) | |
| awk 'NR%2==0' | # remove the header PID | |
| sort | # sort the PID list |
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 pandas | |
| from pandas_datareader import data as pdr | |
| from datetime import datetime, timedelta | |
| import yfinance as yfin | |
| def get_current_prices(symbols: list[str], padding=2): | |
| yfin.pdr_override() | |
| def fmt(date: datetime) -> str: | |
| return date.strftime('%Y-%m-%d') |
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 * as admin from "firebase-admin"; | |
| import * as functions from "firebase-functions"; | |
| type TwilioRequest = { | |
| to: string; | |
| body: string; | |
| } | |
| /** | |
| * Validates if the phone number is in e.164 format. Learn more: https://en.wikipedia.org/wiki/E.164. | |
| * @param {string} phone The phone number you are validating. |
NewerOlder