Skip to content

Instantly share code, notes, and snippets.

View waptik's full-sized avatar
💻
Learning JavaScript and ReactJS...

TheVirginBrokey waptik

💻
Learning JavaScript and ReactJS...
View GitHub Profile
@waptik
waptik / deno.lock
Created December 14, 2024 14:26
new lock file
{
"version": "4",
"specifiers": {
"jsr:@libs/logger@^3.1.0": "3.1.3",
"jsr:@oak/commons@1": "1.0.0",
"jsr:@oak/oak@^17.1.3": "17.1.3",
"jsr:@std/assert@1": "1.0.9",
"jsr:@std/bytes@1": "1.0.4",
"jsr:@std/bytes@^1.0.2": "1.0.4",
"jsr:@std/crypto@1": "1.0.3",
<?
# MIT license, do whatever you want with it
#
# This is my invoice.php page which I use to make invoices that customers want,
# with their address on it and which are easily printable. I love Stripe but
# their invoices and receipts were too wild for my customers on Remote OK
#
require_once(__DIR__.'/../vendor/autoload.php');
@waptik
waptik / gist:bc7bb95b11758401cd49856443332d63
Created September 27, 2024 08:52
get farcaster user moxie fantoken address & name
{
# replace 12 with the id of your choice
# if you want for a channel the value of symbol should be "cid:channel_username"
# eg: cid:fitness
subjectTokens(where: {symbol: "fid:12"}) {
tokenAddress: id
name
}
}
@waptik
waptik / compress-base64-imgs.js
Created June 16, 2024 18:48 — forked from 1isten/compress-base64-imgs.js
js compress image (base64) using canvas api
const toBase64 = (file) => new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = (e) => resolve(e.target.result);
reader.onerror = (err) => reject(err);
});
const compressBase64 = (src, quality = 0.5) => new Promise((resolve) => {
const img = new Image();
img.src = src;
@waptik
waptik / ngrok_hostname.sh
Created January 21, 2024 22:00 — forked from rjz/ngrok_hostname.sh
Get ngrok hostname from command line
#!/bin/sh
# ngrok's web interface is HTML, but configuration is bootstrapped as a JSON
# string. We can hack out the forwarded hostname by extracting the next
# `*.ngrok.io` string from the JSON
#
# Brittle as all get out--YMMV. If you're still reading, usage is:
#
# $ ./ngrok_hostname.sh <proto> <addr>
#
@waptik
waptik / turbo-workspaces-error.sh
Created January 4, 2024 22:48
cli error message for @turbo/workspaces package when migrating from yarn to pnpm
>>> TURBOREPO
Welcome, let's convert your project.
? Where is the root of your repo? .
? Convert from yarn workspaces to: pnpm workspaces
Converting project from yarn to pnpm.
@waptik
waptik / .gitpod.Dockerfile
Created December 23, 2023 22:28
Current gitpod configuration files for my deno fresh app
FROM gitpod/workspace-full
RUN curl -fsSL https://deno.land/x/install/install.sh | sh
RUN /home/gitpod/.deno/bin/deno completions bash > /home/gitpod/.bashrc.d/90-deno && \
echo 'export DENO_INSTALL="/home/gitpod/.deno"' >> /home/gitpod/.bashrc.d/90-deno && \
echo 'export PATH="$DENO_INSTALL/bin:$PATH"' >> /home/gitpod/.bashrc.d/90-deno
@waptik
waptik / personas.menu.ts
Last active December 18, 2023 18:33
a simple pagination handler in grammY using the menu plugin
let pageIndex = 0;
/**
* A function that generates a paginated menu
*
* @param index The index of the page to generate
* @returns A range of the menu
*/
function personalityMenuRange(
@waptik
waptik / Backsticks.txt
Created November 27, 2023 17:42
Ummmm
Certainly! Here's a TypeScript function that takes a text string as input and returns an array of code snippets found within code blocks wrapped in triple backticks(```) or `<code>`:
```typescript
function extractCodeSnippets(text: string): string[] {
const codeSnippets: string[] = [];
const regex = /```([\s\S]*?)```|<code>([\s\S]*?)<\/code>/g;
let match;
while ((match = regex.exec(text)) !== null) {
const codeSnippet = match[1] || match[2];
@waptik
waptik / 1701015161995.txt
Created November 26, 2023 18:53
chatgpt response from api
Certainly! Here's a TypeScript function that takes a text as input and returns an array of code snippets found within multiple lines code blocks wrapped in triple backticks (```) or `<code>` tags with language tags:
```typescript
function extractCodeSnippets(text: string): { language: string, code: string }[] {
const codeBlockRegex = /```(\w+)\n([\s\S]*?)```|<code(?:\s+class="language-(\w+)")?>([\s\S]*?)<\/code>/g;
const codeSnippets: { language: string, code: string }[] = [];
let match;
while ((match = codeBlockRegex.exec(text)) !== null) {
const [, language1, code1, language2, code2] = match;