Skip to content

Instantly share code, notes, and snippets.

View sindre's full-sized avatar

Sindre Wimberger sindre

View GitHub Profile
@cubiq
cubiq / select-reset.html
Created May 27, 2014 12:12
How to reset a select tag
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Styled Select</title>
</head>
<style>
* {
@remy
remy / gist:330318
Created March 12, 2010 13:59
autofocus and placeholder support
/**
* Add this script to the end of your document that use <input autofocus type="text" />
* or <input type="text" placeholder="username" /> and it'll plug support for browser
* without these attributes
* Minified version at the bottom
*/
(function () {
function each(list, fn) {
var l = list.length;
@kaelig
kaelig / gist:458477
Created June 30, 2010 10:04
Make Outlook 2007+ behave with line-heights
// Make Outlook 2007+ behave with line-heights
element {
mso-line-height-rule:exactly;
-mso-line-height-rule:exactly;
}
anonymous
anonymous / ipadlabels
Created August 20, 2010 19:43
var iPadLabels = function () {
function fix() {
var labels = document.getElementsByTagName('label'),
target_id,
el;
for (var i = 0; labels[i]; i++) {
if (labels[i].getAttribute('for')) {
labels[i].onclick = labelClick;
}
@tobie
tobie / whatfreq.js
Last active September 7, 2015 08:04
Sensor sample frequency
// Trying to find the formula to determine the frequency
// at which to sample GPS coordinates of a moving vehicle
// in order to have the maximum precision but not to store
// more data than necessary.
let precision = 1; // The precision of the GPS in meters
let max_speed = 180 / 3.6 // 180km/h converted to m/s = 50m/s
let max_frequency = max_speed / precision;
// Nyquist–Shannon sampling theorem[1] tells us a
@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?
$("#foo").click(function(e){
if (e.clientX) {
// native mouse click
}
else {
// triggered mouse click
}
});
@balupton
balupton / bind.trigger.prototype.js
Created January 26, 2011 15:42
Bind and Trigger Custom and Native Events in Prototype
/**
* Bind and Trigger custom and native events in Prototype
* @author Juriy Zaytsev (kangax)
* @author Benjamin Lupton (balupton)
* @copyright MIT license
**/
(function(){
var eventMatchers = {
'HTMLEvents': /^(?:load|unload|abort|error|select|hashchange|popstate|change|submit|reset|focus|blur|resize|scroll)$/,
@DGuidi
DGuidi / leaflet.google.js
Created March 7, 2012 12:27
leaflet+google integration
/*
* Here the 'inspiration': http://goo.gl/OKL9A
* Adapted from: http://psha.org.ru/leaflet/Google.js
* Demo: http://psha.org.ru/leaflet/bel.html
* This code works well with jquerymobile:
* the original code maintain a div.height of 0 for the internal google container
* REMARKS: this
* NOTE: jQuery required!
*/
@brunob
brunob / TileLayer.TileJSON.js
Created April 24, 2012 13:10 — forked from DGuidi/TileLayer.TileJSON.js
Leaflet TileCanvas
L.TileLayer.TileJSON = L.TileLayer.Canvas.extend({
options: {
debug: false
},
tileSize: 256,
initialize: function (options) {
L.Util.setOptions(this, options);