Skip to content

Instantly share code, notes, and snippets.

@anddoutoi
anddoutoi / ms.js
Created February 13, 2012 11:44
Function that parses stuff to milliseconds
/* inspiration from Jan-Marten de Boer´s Time.js, https://github.com/johmanx10/Time.js */
var ms = (function () {
'use strict';
var second = 1000,
minute = second*60,
hour = minute*60,
day = hour*24,
//week = day*7,
//year = second*3.154e7,// According to Wolfram|Alpha
@anddoutoi
anddoutoi / forEachInObject.js
Created January 23, 2012 21:59
JavaScript utility functions
var forEachInObject = (function () {
'use strict';
var fn = function ( f, args ) {
var o = this,
keys = Object.keys( o ),
i, key;
i = 0;
while ( (key = keys[i++]) ) {
@anddoutoi
anddoutoi / gist:1596643
Created January 11, 2012 20:39
Mozilla Gecko about:s
Mozilla Gecko about:s
about:about
about:config
about:home
about:mozilla
about:plugins
about:rights
about:robots
@anddoutoi
anddoutoi / gist:1345268
Created November 7, 2011 15:23
A somewhat working patch for ie7 button width issues
.ie7 button,
.ie7 input[type="button"],
.ie7 input[type="reset"],
.ie7 input[type="submit"]
{
margin: 0;
padding: 0 15px;
overflow: expression(
this.style.overflow = 'visible',
this.style.pixelWidth = function (w) {
@anddoutoi
anddoutoi / index.html
Created June 15, 2011 13:14
Google Chrome bug with list-style-type: none / position: relative / floats combo. Tested in GC12.0.742.91
<!DOCTYPE html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8">
<title></title>
<style>
ul {
margin: 0;
padding: 0;
}
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}