Skip to content

Instantly share code, notes, and snippets.

View kristofferh's full-sized avatar
🍔

Kristoffer Hedstrom kristofferh

🍔
View GitHub Profile
@kristofferh
kristofferh / momentum-sticky.js
Created November 30, 2017 20:58
Momentum effect for sticky/fixed elements
let element;
let scrollTop = 0;
let pinTop = 0;
let lastTime;
let options = {
lag: 50,
maxSpeed: 100,
frameRate: 30
};
@kristofferh
kristofferh / remove python compiled code.md
Last active May 25, 2017 19:09
remove python compiled code

find . -name '*.pyc' | xargs rm

Keybase proof

I hereby claim:

  • I am kristofferh on github.
  • I am hedstrom (https://keybase.io/hedstrom) on keybase.
  • I have a public key whose fingerprint is 6059 DDBE 95B3 90F3 547B 3D12 16EB A687 B891 5B52

To claim this, I am signing this object:

@kristofferh
kristofferh / git-commands.md
Last active October 12, 2015 02:38
Random git commands

Helpful Git Commands

A random collection of git commands that were helpful to me, and might be helpful to you.

Search commits

git log --grep="search query"

List branches

@kristofferh
kristofferh / opendiff.txt
Created June 8, 2012 14:24
Open FileMerge from command line
Open FileMerge from command line
opendiff
If the command-line doesn't work, and you have no /Developer directory anymore, you probably need to:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
@kristofferh
kristofferh / git-aliases.txt
Created May 16, 2012 15:48
List all git aliases
List just aliases
$ git config --get-regexp alias
List all config parameters
$ git config --list
@kristofferh
kristofferh / gist:1690703
Created January 27, 2012 20:18
Enable media streaming (plus access to webcam) in Canary
/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary --enable-media-stream
@kristofferh
kristofferh / git-export
Created December 7, 2011 13:01
"Export" a git repository to zip file
git archive --format zip --output /full/path/to/zipfile.zip master
@kristofferh
kristofferh / before-pseudo-check.js
Created May 17, 2011 22:22
Check if :before pseudo selector is supported
/**
* Check if :before pseudo selector is supported. This can be useful for sprites.
* usage: if(!pseudoTest()) {
* // do polyfill
* }
*/
var pseudoTest = (function() {
var cache;
return function() {
@kristofferh
kristofferh / placeholder.js
Created March 30, 2011 15:51
Fallback for placeholder attribute
/**
* Quick/dirty polyfill for placeholder attribute
* Requirements: jQuery
* Usage:
* var placeIt = Placeholder.init('input#search');
*/
var Placeholder = (function() {
// private methods