Skip to content

Instantly share code, notes, and snippets.

@brianyang
brianyang / console-dummy.js
Created January 20, 2012 19:36
console dummy
if(typeof console === "undefined") {
console = { log: function() { } };
}
@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
/**********************************************/
/*
/* 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/
/*
@Kartones
Kartones / postgres-cheatsheet.md
Last active July 25, 2024 09:09
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)
@ericelliott
ericelliott / essential-javascript-links.md
Last active July 18, 2024 15:03
Essential JavaScript Links
@sebmarkbage
sebmarkbage / Enhance.js
Last active January 31, 2024 18:33
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() {
@paulirish
paulirish / what-forces-layout.md
Last active July 27, 2024 23:38
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
@hfreire
hfreire / qemu_osx_rpi_raspbian_jessie.sh
Last active March 24, 2024 14:35
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
@radum
radum / charles-map-remote.md
Last active March 21, 2024 08:02
Charles proxy Map Remote over HTTP or HTTPS

Charles Proxy Map Remote over HTTP or HTTPS

The Map Remote tool changes the request location, per the configured mappings, so that the response is transparently served from the new location as if that was the original request.

HTTP

Using this feature for http resources does't require anything else apart from just configuring your Map Remote entry.

Always make sure you are clearing your cache before you test. Even if Charles is configured properly you might not see the changes unless the browser gets the resource again from the server and not for its local cache.
@addyosmani
addyosmani / pwas.md
Last active June 10, 2020 18:30
💄💋 Progressive Web Apps across popular frameworks that I have written or contributed significantly to

React HN (Universal rendering, Offline caching, optimisations)

React + Webpack application using the PRPL pattern