Skip to content

Instantly share code, notes, and snippets.

🙃
Hello!

Sean Zhu szhu

🙃
Hello!
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
paulirish / what-forces-layout.md
Last active Nov 15, 2019
What forces layout/reflow. The comprehensive list.
View what-forces-layout.md

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.

Element

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
obfusk / break.py
Last active Nov 12, 2019
python equivalent of ruby's binding.pry
View break.py
import code; code.interact(local=dict(globals(), **locals()))
@bensmithett
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 https://github.com/jsdf/coffee-react-transform/issues/16
displayName: "AppComponent"
render: ->
<div>
@papaben
papaben / git.sh
Created Apr 18, 2014
My typical answer when git asks, "Did you mean?"
View git.sh
##
# "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)
@parser=parser
end
def mark
@parser.mark
@n-b
n-b / selfcompile.m
Last active Apr 29, 2019
A simple self-compiling objective-c file
View selfcompile.m
/*/../bin/ls > /dev/null
COMPILED=${0%.*}
clang $0 -o $COMPILED -framework Foundation;
$COMPILED; rm $COMPILED; exit;
*/
#import <Foundation/Foundation.h>
int main(int argc, char *argv[])
@rnapier
rnapier / fix-xcode
Last active Aug 28, 2019
Links Xcode SDKs from the /SDKs directory (which you maintain yourself)
View fix-xcode
#!/usr/bin/python
# fix-xcode
# Rob Napier <robnapier@gmail.com>
# 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
logosity / tail.sh
Created May 9, 2012
Tail Recursion in bash
View tail.sh
#!/bin/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 tail.sh
anonymous
anonymous / gist:2523336
Created Apr 29, 2012
Changing author info
View gist:2523336
#!/bin/sh
git filter-branch --env-filter '
an="$GIT_AUTHOR_NAME"
am="$GIT_AUTHOR_EMAIL"
cn="$GIT_COMMITTER_NAME"
cm="$GIT_COMMITTER_EMAIL"
if [ "$GIT_COMMITTER_EMAIL" = "your@email.to.match" ]
You can’t perform that action at this time.