Skip to content

Instantly share code, notes, and snippets.

@topheman
topheman / git-notes.md
Created June 29, 2015 17:39
Git notes cheat sheet
@paulirish
paulirish / what-forces-layout.md
Last active May 12, 2024 13:20
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@paolobrasolin
paolobrasolin / README.md
Last active May 12, 2024 13:17
A::B prompting challenge
#include <iostream>
#include <fstream>
#include <cstdlib> // For rand() and srand()
#include <ctime> // For time()
#include <string>
#include <vector>
const int MAX_WIDTH = 50;
const int MAX_HEIGHT = 40;
const int MAX_FIRE_DISTANCE = 10;
@nickyvanurk
nickyvanurk / camera.tsx
Last active May 12, 2024 13:14
Camera perspective <-> orthographic toggle in r3f and vanilla three.js
import { useEffect, useRef, useState } from 'react';
import { useFrame, useThree } from '@react-three/fiber';
import { MapControls, OrthographicCamera, PerspectiveCamera } from '@react-three/drei';
import type { OrbitControls as OrbitControlsImpl } from 'three-stdlib';
export function Camera() {
const [oldType, setOldType] = useState('PerspectiveCamera');
const [coords, setCoords] = useState({ x: 0, y: 0 });
const gl = useThree((state) => state.gl);
@gboncoffee
gboncoffee / saguisimdasm.exs
Created May 11, 2024 23:54
Assembler de Sagui Vetorial (Sagui em Bando)
#
# Montador ridiculamente simples para Assembly de Sagui Vetorial.
# Escreve arquivos no formato hex do Logisim Evolution.
# (Informações sobre a licença abaixo)
# (Licensing information below)
#
# DÚVIDAS:
#
# - Como eu uso essa desgraça?
#
@francois-rozet
francois-rozet / flow_matching.py
Last active May 12, 2024 13:05
Flow Matching in 100 LOC
#!/usr/bin/env python
import math
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
from sklearn.datasets import make_moons
from torch import Tensor
from tqdm import tqdm
@jhrcook
jhrcook / common-github-badges.md
Last active May 12, 2024 13:05
A list of GitHub badges I usually add to me README files.

GitHub Badges

Social

jhc github jhc twitter jhc website

Code

@rasmi
rasmi / setup.md
Last active May 12, 2024 13:03
Python development environment setup on Chromebook

Python development environment setup on Chromebook

Check for updates

Do this first!

sudo apt-get update && sudo apt-get dist-upgrade

Set root password

@inorganik
inorganik / app.js
Last active May 12, 2024 13:01
Using CountUp.js in React
import { useEffect, useRef } from 'react'
// playground: https://stackblitz.com/edit/react-ts-nv5fxe?file=App.tsx
export default function App() {
// create a ref and declare an instance for each countUp animation
const countupRef = useRef(null);
let countUpAnim;