function drawImageFromUrl(url, canvasId, x = 0, y = 0) {
const canvas = document.getElementById(canvasId)
const ctx = canvas.getContext('2d')
const img = new Image()
img.onload = function() {
ctx.drawImage(img, x, y)
}
This file contains 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 ($) { | |
$.fn.button = function (action) { | |
const $btn = $(this) | |
let alt_text = 'Loading' | |
if (action === 'loading') { | |
let original_icon = false | |
$btn.attr('data-oringinal-text', $btn.text()) | |
if ($btn.has('i').length) original_icon = $btn.find('i').attr('class') | |
$btn.attr('data-oringinal-icon', original_icon) |
This file contains 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
package main | |
import ( | |
"fmt" | |
"net/http" | |
) | |
var urls = []string{ | |
"https://expired.badssl.com/", | |
"https://oskr.nl", |
This file contains 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/python3 | |
import sys | |
from openai import OpenAI | |
client = OpenAI() | |
user_input = ' '.join(sys.argv[1:]) | |
shell = 'BASH' |
This file contains 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
html, body { | |
margin: 0; | |
padding: 0; | |
height: 100vh; | |
} | |
body { | |
background: #121212; | |
color: #f4f4f4; | |
display: flex; |
This file contains 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 fast, { type Context } from 'https://deno.land/x/fast@3.8.0/mod.ts' | |
import { | |
verifySignedCookie, | |
} from 'https://deno.land/x/squishy_cookies@v1.0.0/mod.ts' | |
const COOKIE_SECRET = 'super_secret' | |
const app = fast() | |
/* |
This file contains 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
export function formatNumber(num: number): string { | |
if (num < 1000) return num.toString() | |
// If the number is between 1000 and 999999, divide it by 1000 and append K | |
else if (num >= 1000 && num <= 999999) { | |
return (num / 1000).toFixed(1) + "K" | |
} | |
// If the number is greater than or equal to 1000000, divide it by 1000000 and append mil | |
else { | |
return (num / 1000000).toFixed(1) + "M" |
This file contains 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
// Using Deno :P | |
import { z } from 'npm:zod' | |
const User = z.object({ | |
username: z.string(), | |
email: z.string().email() | |
}) | |
function getMissingFields(error: z.ZodError): string[] { | |
const missingFields: string[] = [] |
This file contains 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 toOldeEnglish(text: string, is_bold = false) { | |
const regularUpper = { | |
A: "𝔄", | |
B: "𝔅", | |
C: "ℭ", | |
D: "𝔇", | |
E: "𝔈", | |
F: "𝔉", | |
G: "𝔊", | |
H: "ℌ", |
This file contains 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
<html theme="%theme%" lang="%lang%" dir="%dir%"> |
NewerOlder