Skip to content

Instantly share code, notes, and snippets.

View mathiasbynens's full-sized avatar

Mathias Bynens mathiasbynens

View GitHub Profile
@paulirish
paulirish / gist:576335
Created September 12, 2010 19:05
Things to do when IE9 Beta comes out

Things to do when IE9 Beta comes out

Note significant features added since IE9 PP4

  • Implemented but not announced: box-shadow, hsla
  • Expecting: 2d transforms, css animation, css transitions, flexible box model
  • Maybe: gradients, columns, reflections, svg filters, uncrippling @font-face, 3d transforms
  • Maybe version auto-update functionality

Test Modernizr against it

  • Does it still throw an error checking elem.msTransform?
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active February 20, 2025 22:23
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@paulirish
paulirish / utmstrip.user.js
Last active September 17, 2024 11:03
userscript: Drop the UTM params from a URL when the page loads
// ==UserScript==
// @name UTM param stripper
// @author Paul Irish
// @namespace http://github.com/paulirish
// @version 1.2
// @description Drop the UTM params from a URL when the page loads.
// @extra Cuz you know they're all ugly n shit.
// @include http*://*
// ==/UserScript==
@peol
peol / jquery-selector-formatter.js
Created November 7, 2010 21:05
With this short snippet, you can utilize $.format('selector', val1, val2, ...).jQueryMethod1() instead of concating your dynamic strings, making them hard-to-read/debug/whatever
// It works kinda like the asp.net's String.Format, meaning that you use {n} templates,
// {0} = your first argument (after the selector), {1} your second (after the selector) etc.
!function($, undefined) {
$.format = function(selector) {
var sel, args = arguments;
sel = selector.replace(/{\d}/g, function(part) {
var i = parseFloat( part.replace(/{|}/g, '') );
return typeof i === 'number' ? args[i+1] || '' : '';
meter{
display: block;
border: 1px outset;
height: 20px;
width: 100px;
overflow: hidden;
}
meter div
{
display: block;
@westonruter
westonruter / mousewheel-scrollable-text-inputs.user.js
Created November 10, 2010 10:53
MouseWheel-scrollable Text Inputs User Script for Chrome: Enable horizontally scrollable text inputs via mousewheel (like Firefox)
// ==UserScript==
// @name MouseWheel-scrollable Text Inputs
// @description Enable horizontally scrollable text inputs via mousewheel, to make Chrome behave like Firefox.
// @include *
// @namespace http://weston.ruter.net/
// ==/UserScript==
document.addEventListener('mousewheel', function(e){
var target = e.target;
if(target.nodeName.toLowerCase() == 'input'){
@subtleGradient
subtleGradient / appify
Created November 11, 2010 16:03
appify. Create the simplest possible mac app from a shell script
#!/usr/bin/env bash
#
# url : https://gist.github.com/672684
# version : 2.0.2
# name : appify
# description : Create the simplest possible mac app from a shell script.
# usage : cat my-script.sh | appify MyApp
# platform : Mac OS X
# author : Thomas Aylott <[email protected]>
# Tips for jQuery Bug Patching
# There are some assumptions made here, one being that you're
# set up with some form of "localhost" http server and that it's running.
# - http://www.mamp.info/en/mamp/
# - sudo apt-get install apache2
# Get it running:
# On Mac:
@getify
getify / gist:675496
Created November 13, 2010 17:18
detecting if flash plugin is installed
var _flash_installed = ((typeof navigator.plugins != "undefined" && typeof navigator.plugins["Shockwave Flash"] == "object") || (window.ActiveXObject && (new ActiveXObject("ShockwaveFlash.ShockwaveFlash")) != false));
@getify
getify / gist:710231
Created November 22, 2010 16:48
how to detect IE from JavaScript using conditional comments
// stripped down version just detecting IE
(function(global){
global._isIE = false;
try {
var div = document.createElement("div");
div.innerHTML = "<!--[if IE]><i></i><![endif]-->";
global._isIE = (div.getElementsByTagName("i").length > 0);
} catch(err) { }
})(window);