Skip to content

Instantly share code, notes, and snippets.

@juhaelee
juhaelee / react-typescript.md
Last active January 26, 2023 00:52
React + Typescript Cheatsheet

React + Typescript Cheatsheet

Setup

If you use atom... download & install the following packages:

What are Typescript type definition files? (*.d.ts)

@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@paulirish
paulirish / what-forces-layout.md
Last active April 16, 2024 17:32
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
@n0531m
n0531m / list_gcp_iprange.sh
Last active April 17, 2024 21:50
Google Cloud Platform : ip address range
#!/bin/bash
# https://cloud.google.com/compute/docs/faq#find_ip_range
# nslookup -q=TXT _cloud-netblocks.googleusercontent.com 8.8.8.8
myarray=()
for LINE in `dig txt _cloud-netblocks.googleusercontent.com +short | tr " " "\n" | grep include | cut -f 2 -d :`
do
myarray+=($LINE)
for LINE2 in `dig txt $LINE +short | tr " " "\n" | grep include | cut -f 2 -d :`

How to set your Acer C720 Chromebook to boot to Ubuntu by default.

  1. Place your closed laptop on a soft surface, upside down.
  2. Use a sharp knife to cut a hole in the warranty sticker (YES THIS WILL VOID THE WARRANTY).
  3. Remove the 13 screws with a small phillips head screwdriver (PH1 size works well). Be careful, the screws are very small and will strip easily if you use the wrong size screwdriver.
  4. Remove the bottom of the laptop by pulling up on it near the hinges. It takes a bit of pressure to remove, but if you lift it from the back (near the hinges) the same way you would open a laptop screen, the hooks won't break (even though they will make a loud snapping sound).
  5. Remove the BIOS write-protect screw. It is labeled as #7 in this image
  6. With the bottom off, turn over the laptop and open the screen.
  7. Plug the laptop in (it must b