Skip to content

Instantly share code, notes, and snippets.

import "./index.css";
import React from "react";
import ReactDOM from "react-dom";
import {
DataBrowserRouter,
Route,
useLoaderData,
Form,
useNavigation,
} from "react-router-dom";
@Python-Test-Engineer
Python-Test-Engineer / gist:99d95dfb87bf776f68e11880a2cd5176
Created April 2, 2022 09:05
event-loop-next-tick-setimmediate
const TIMEOUT_MS = 12;
process.stdout.write('=== SYNC Root Code - START\n');
// 1
setImmediate(() => {
process.stdout.write('----------------------------\n\n');
process.stdout.write('1: --setImmediate1\n');
Promise.resolve().then((x) => {
@gaearon
gaearon / Wordle.js
Created January 22, 2022 20:49
wordle v3 (tiny wordle clone i built during a stream) https://www.youtube.com/watch?v=Qxn4-bTOx0g
import { useState, useEffect, useRef, useMemo } from 'react'
export default function Wordle() {
let [currentAttempt, setCurrentAttempt] = useState('')
let [bestColors, setBestColors] = useState(() => new Map())
let [history, setHistory] = usePersistedHistory(h => {
waitForAnimation(h)
})
useEffect(() => {
@gaearon
gaearon / index.html
Created January 15, 2022 03:26
tiny worldle clone i built during a stream https://www.youtube.com/watch?v=K77xThbu66A
<h1>Wordle</h1>
<div id="grid"></div>
<style>
body, html {
background: #111;
color: white;
font-family: sans-serif;
text-align: center;
text-transform: uppercase;
}
<div id="canvas"></div>
<style>
#canvas {
width: 500px;
height: 300px;
border: 5px solid black;
position: relative;
box-sizing: content-box;
}
@gaearon
gaearon / Classes.js
Created May 27, 2020 17:38
Beneath Classes: Prototypes
class Spiderman {
lookOut() {
alert('My Spider-Sense is tingling.');
}
}
let miles = new Spiderman();
miles.lookOut();
@aoirint
aoirint / Dockerfile
Last active July 6, 2023 03:23
Hello World Deno (Docker)
FROM ubuntu:bionic
WORKDIR /code
RUN apt update && apt install -y curl unzip
RUN curl -fsSL https://deno.land/x/install/install.sh | sh
RUN echo "export PATH=\$HOME/.deno/bin:\$PATH" >> $HOME/.bashrc
@bradtraversy
bradtraversy / pdocrash.php
Last active September 25, 2023 16:37
PDO & Prepared Statements Snippets
<?php
$host = 'localhost';
$user = 'root';
$password = '123456';
$dbname = 'pdoposts';
// Set DSN
$dsn = 'mysql:host='. $host .';dbname='. $dbname;
// Create a PDO instance
@ChrisPatten
ChrisPatten / docker-machine.ps1
Last active December 7, 2021 10:16
Installing and configuring docker-machine on 32-bit Windows 10
choco install docker-machine -y
docker-machine create --driver virtualbox default
docker-machine env | Invoke-Expression
@subfuzion
subfuzion / curl.md
Last active May 6, 2024 09:53
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.