Skip to content

Instantly share code, notes, and snippets.


Sean Zhu szhu

Block or report user

Report or block szhu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View FindMode.js
// FindMode - phoenix binding for an interactive window-finding mode
// * bind to a key by calling the instance's 'bind' method, which has the
// same first two args as phoenix's Phoenix.bind() call. The third argument
// is an array of other key bindings which should be temporarily disabled
// while in the FindMode mode.
// * while in Find mode:
// - hit escape to exit the mode (todo: and restore the window stack)
// - type a regex to interactively auto-raise the first window that matches
// - backspace to remove chars from the regex
// - hit tab to cycle to the next matching window for the current regex
paulirish /
Last active Nov 15, 2019
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.


Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
obfusk /
Last active Nov 12, 2019
python equivalent of ruby's binding.pry
import code; code.interact(local=dict(globals(), **locals()))
bensmithett / AppComponent.cjsx
Last active Jun 19, 2018
The world's tiniest guide to getting started with React, JSX, CoffeeScript & Webpack
View AppComponent.cjsx
React = require("react")
VideoPlayerComponent = require("components/VideoPlayerComponent")
AppComponent = React.createClass
# Need to add this manually if you want it to show up in React Chrome Dev Tools
# See
displayName: "AppComponent"
render: ->
papaben /
Created Apr 18, 2014
My typical answer when git asks, "Did you mean?"
# "I did [mean that]"
# Re-run the suggested git command
# Intended to be run as 'idid !!'
function idid() {
declare last=''
while [[ $# > 0 ]]; do
last="$last $1"
View psych_handler_with_mark.rb
require 'psych'
class ScalarHandler < Psych::Handler
def parser=(parser)
def mark
n-b / selfcompile.m
Last active Apr 29, 2019
A simple self-compiling objective-c file
View selfcompile.m
/*/../bin/ls > /dev/null
clang $0 -o $COMPILED -framework Foundation;
#import <Foundation/Foundation.h>
int main(int argc, char *argv[])
rnapier / fix-xcode
Last active Aug 28, 2019
Links Xcode SDKs from the /SDKs directory (which you maintain yourself)
View fix-xcode
# fix-xcode
# Rob Napier <>
# Script to link in all your old SDKs every time you upgrade Xcode
# Create a directory called /SDKs (or modify source_path).
# Under it, put all the platform directories:
# MacOSX.platform iPhoneOS.platform iPhoneSimulator.platform
# Under those, store the SDKs:
logosity /
Created May 9, 2012
Tail Recursion in bash
# warning you need to build in something to stop the loop
# in practice, I used a kill file check before invoking the script again
echo 'tail recursive bash ftw'
sleep 10
$0 &
# if you didn't listen and ran this as-is, try:
# killall
anonymous / gist:2523336
Created Apr 29, 2012
Changing author info
View gist:2523336
git filter-branch --env-filter '
if [ "$GIT_COMMITTER_EMAIL" = "" ]
You can’t perform that action at this time.