Skip to content

Instantly share code, notes, and snippets.

View sonnylazuardi's full-sized avatar
🎯
Focusing

Sonny Lazuardi sonnylazuardi

🎯
Focusing
View GitHub Profile
@lichin-lin
lichin-lin / heart.js
Last active February 14, 2024 14:16
💝 v-day-dev-mode
const r = document.querySelector('div [data-testid=annotation-renderer-shadow-dom-container]')
let duration = 4000
const speed = 0.5;
const cursorXOffset = 0;
const cursorYOffset = -5;
let hearts = []
function generateHeart(x = 0, y = 0, xBound, xStart, scale, parent) {
let heart = document.createElement("div");
heart.setAttribute('class', 'heart');
@tnarla
tnarla / 8ball.tsx
Created November 7, 2023 20:08
8ball code!
"use client";
import { motion } from "framer-motion";
import { useCallback, useEffect, useRef, useState } from "react";
interface Todo {
text: string;
completed: boolean;
}
@imballinst
imballinst / abuse-scammer-server.mjs
Last active October 12, 2023 07:17
Script to spam and DDoS scammer's server
import axios from 'axios'
// How to use this script:
//
// 0. Create a directory (with any name), then inside that directory, initialize package.json with `npm init -y`, then install axios with `npm install axios`.
// 1. Identify the website that the scammer use. Prefer use desktop browser with private window, just in case.
// 2. Fill out their form (do this with the Network in DevTools open). Don't use real values, just use random values.
// 3. After finding out the request payload (and possibly headers), adjust the below script accordingly.
// 4. Run with `node abuse-scammer-server.mjs` (or whatever the file name is in your local machine).
// 5. See if their server goes down! Usually websites that scammers use don't really have a good DDoS or spam protection, so, yeah.
@gaearon
gaearon / 00-README-NEXT-SPA.md
Last active October 14, 2024 00:05
Next.js SPA example with dynamic client-only routing and static hosting

Next.js client-only SPA example

Made this example to show how to use Next.js router for a 100% SPA (no JS server) app.

You use Next.js router like normally, but don't define getStaticProps and such. Instead you do client-only fetching with swr, react-query, or similar methods.

You can generate HTML fallback for the page if there's something meaningful to show before you "know" the params. (Remember, HTML is static, so it can't respond to dynamic query. But it can be different per route.)

Don't like Next? Here's how to do the same in Gatsby.

@bluelovers
bluelovers / ChatGPT Stable Diffusion prompts generator.txt
Last active September 26, 2024 12:49
using ChatGPT as Stable Diffusion prompts generator
Stable Diffusion is an AI art generation model similar to DALLE-2.
Here are some prompts for generating art with Stable Diffusion.
Example:
- A ghostly apparition drifting through a haunted mansion's grand ballroom, illuminated by flickering candlelight. Eerie, ethereal, moody lighting.
- portait of a homer simpson archer shooting arrow at forest monster, front game card, drark, marvel comics, dark, smooth
- pirate, deep focus, fantasy, matte, sharp focus
- red dead redemption 2, cinematic view, epic sky, detailed, low angle, high detail, warm lighting, volumetric, godrays, vivid, beautiful
- a fantasy style portrait painting of rachel lane / alison brie hybrid in the style of francois boucher oil painting, rpg portrait
@rikschennink
rikschennink / main.rs
Created December 13, 2022 14:10
Tauri MacOS tray app
#![cfg_attr(
all(not(debug_assertions), target_os = "windows"),
windows_subsystem = "windows"
)]
// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
#[tauri::command]
fn sync(name: &str) -> String {
format!("Hello, {}! You've been greeted from Rust!", name)
{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {},
      "geometry": {
        "coordinates": [
 [
@jacob-ebey
jacob-ebey / image.ts
Last active September 18, 2024 19:12
Remix Image Component
import { createHash } from "crypto";
import fs from "fs";
import fsp from "fs/promises";
import path from "path";
import https from "https";
import { PassThrough } from "stream";
import type { Readable } from "stream";
import type { LoaderFunction } from "remix";
import sharp from "sharp";
import type { Request as NodeRequest } from "@remix-run/node";
@netgfx
netgfx / App.tsx
Created August 20, 2021 21:47
complete-framer+supabase
import { ComponentType, useEffect } from "react"
import { createStore } from "https://framer.com/m/framer/store.js@^1.0.0"
import { randomColor } from "https://framer.com/m/framer/utils.js@^0.9.0"
import { createClient } from "https://cdn.skypack.dev/@supabase/supabase-js"
import { md5 } from "https://cdn.skypack.dev/pure-md5"
import { browser, checkUsername, checkPassword, useStore } from "./globals.ts"
// Learn more: https://www.framer.com/docs/guides/overrides/
export function initDB(Component): ComponentType {
@lambertbrady
lambertbrady / pyodide-provider.js
Created July 13, 2021 23:35
Pyodide React Component
import { createContext, useRef, useState } from 'react'
export const PyodideContext = createContext()
export default function PyodideProvider({ children }) {
const pyodide = useRef(null)
const hasLoadPyodideBeenCalled = useRef(false)
const [isPyodideLoading, setIsPyodideLoading] = useState(true)
return (