Skip to content

Instantly share code, notes, and snippets.

View remy's full-sized avatar
🐹
Always hacking

Remy Sharp remy

🐹
Always hacking
View GitHub Profile
/*!
* jQuery ie6ize: Emulate IE-6 rendering - 11/13/2009
* http://mankzblog.wordpress.com/2009/11/13/ie6-frame-to-battle-chrome-frame/
*
* Created by Mats Bryntse
*
* Plugin-ified by "Cowboy" Ben Alman
* http://benalman.com/
*/
// Attempt to make a drop-and-forget bunch of scripts that mimick some missing html5 goodies automatically
// Example:
// $(document).ready(function() {
// ProvideHtml5.autofocus()
// ProvideHtml5.datepicker()
// ProvideHtml5.forcenumber()
// })
var ProvideHtml5 = {
autofocus = function() {
// Attempt to make a drop-and-forget bunch of scripts that mimick some missing html5 goodies automatically
// Example:
// $(document).ready(function() {
// ProvideHtml5.autofocus()
// ProvideHtml5.datepicker()
// ProvideHtml5.forcenumber()
// })
var ProvideHtml5 = {
autofocus = function() {
@remy
remy / gist:296785
Created February 6, 2010 16:12 — forked from kangax/gist:296114
// original (http://html5shiv.googlecode.com/svn/trunk/html5.js)
(function(){if(!/*@cc_on!@*/0)return;var e = "abbr,article,aside,audio,canvas,datalist,details,figure,figcaption,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,summary,time,video".split(','),i=e.length;while(i--){document.createElement(e[i])}})()
// @rem version - 68 characters less, and much more maintainable than @pornelski - how do you like /them/ apples? :-)
// that said - change @pornelski's version so it uses spaces and it's easy maintainable, and still the shortest. /hattip to @pornelski
/*@cc_on(function(e){for(;e[0];document.createElement(e.pop())){}})('abbr article aside audio canvas details figure footer header hgroup mark menu meter nav output progress section time video'.split(' '))@*/
@remy
remy / gist:333954
Created March 16, 2010 13:21 — forked from madrobby/gist:333764
Beautiful one line array shuffle
// pure JS
function shuffle(array) {
return array.sort(function(){
return .5 - Math.random();
});
}
// with Prototype.js you can do
function shuffle(array){
return array.sortBy(Math.random);
@remy
remy / gist:360018
Created April 8, 2010 12:07 — forked from padolsey/gist:360015
Get element from mouse position
var x,y;
document.onmousemove = function(e){
e = e || window.event;
x = e.clientX;
y = e.clientY;
};
function elementAtMousePosition() {
return document.elementFromPoint(x,y);
@remy
remy / html5-data.js
Created April 10, 2010 15:45 — forked from fearphage/html5-data.js
data-* support
(function () {
var forEach = [].forEach,
regex = /^data-(.+)/,
dashChar = /\-([a-z])/ig,
el = document.createElement('div'),
mutationSupported = false,
match
;
function detectMutation() {
@remy
remy / demo.html
Created June 3, 2010 20:32 — forked from njonsson/demo.html
Just a refactor for njonsson - Example seen here: http://jsbin.com/ayoxa4/2
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang='en-US' xml:lang='en-US' xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>
passwordComplexity jQuery plugin demo
</title>
<style type='text/css'>
* {
font-family: Helvetica, Arial, sans-serif;
// Provides a device_scale class on iOS devices for scaling user
// interface elements relative to the current zoom factor.
//
// http://37signals.com/svn/posts/2407-device-scale-user-interface-elements-in-ios-mobile-safari
// Copyright (c) 2010 37signals.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
(function() {
var css = [
'/css/default.css',
'/css/section.css',
'/css/custom.css'
],
i = 0,
link = document.createElement('link');
link.rel = 'stylesheet',
head = document.getElementsByTagName('head')[0],