Skip to content

Instantly share code, notes, and snippets.

View brianyang's full-sized avatar

Brian Yang brianyang

View GitHub Profile
@hfreire
hfreire / qemu_osx_rpi_raspbian_jessie.sh
Last active February 4, 2025 00:47
How to emulate a Raspberry Pi (Raspbian Jessie) on Mac OSX (El Capitan)
# Install QEMU OSX port with ARM support
sudo port install qemu +target_arm
export QEMU=$(which qemu-system-arm)
# Dowload kernel and export location
curl -OL \
https://github.com/dhruvvyas90/qemu-rpi-kernel/blob/master/kernel-qemu-4.1.7-jessie
export RPI_KERNEL=./kernel-qemu-4.1.7-jessie
# Download filesystem and export location
@paulirish
paulirish / what-forces-layout.md
Last active August 2, 2025 07:28
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
@sebmarkbage
sebmarkbage / Enhance.js
Last active June 19, 2025 19:41
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
@ericelliott
ericelliott / essential-javascript-links.md
Last active June 14, 2025 18:43
Essential JavaScript Links
@Kartones
Kartones / postgres-cheatsheet.md
Last active August 3, 2025 00:22
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
/**********************************************/
/*
/* IR_Black Skin by Ben Truyman - 2011
/*
/* Based on Todd Werth's IR_Black:
/* http://blog.toddwerth.com/entries/2
/*
/* Inspired by Darcy Clarke's blog post:
/* http://darcyclarke.me/design/skin-your-chrome-inspector/
/*
@brianyang
brianyang / .bash_profile
Last active October 12, 2015 15:08
apply-dev-tools-style
alias dev-monokai="curl -O https://raw.github.com/gist/4045346/8f0d02c2eccdeb5b89150de6e895e59f7a36b624/apply-monokai.sh && sh apply-monokai.sh && rm apply-monokai.sh"
alias dev-tommorrow="curl -O https://raw.github.com/gist/4045346/6770ce4eb208d57bf495a23bbd0d0226a2f371ac/apply-tomorrow.sh && sh apply-tomorrow.sh && rm apply-tomorrow.sh"
alias dev-solarized="curl -O https://raw.github.com/gist/4045346/35fe6535dc1f11a7cb073725edf614510e79c411/apply-solarized.sh && sh apply-solarized.sh && rm apply-solarized.sh"
alias dev-tom80="curl -o ~/Library/Application\ Support/Google/Chrome/Default/User\ StyleSheets/Custom.css https://raw.github.com/chriskempson/tomorrow-theme/master/Web%20Inspector/Tomorrow%20Night%20Eighties/Custom.css"
alias dev-darcy='curl -o ~/Library/Application\ Support/Google/Chrome/Default/User\ StyleSheets/Custom.css http://darcyclarke.me/dev/inspectorskin/Custom.css'
alias devcan-monokai="curl -O ~/Library/Application\ Support/Google/Chrome\ Canary/Default/User\ StyleSheets/Custom.css https
@brianyang
brianyang / console-dummy.js
Created January 20, 2012 19:36
console dummy
if(typeof console === "undefined") {
console = { log: function() { } };
}