Skip to content

Instantly share code, notes, and snippets.

@dshster
dshster / grunt-coffee.js
Created November 21, 2012 18:31 — forked from zonak/grunt-coffee.js
grunt task for compiling CoffeScript
/*
* Grunt Task File
* ---------------
*
* Task: coffee
* Description: Compile CoffeeScript files
* Dependencies: coffee-script
*
*/
@dshster
dshster / gist:3903960
Created October 17, 2012 06:16
webkit notification
( window.webkitNotifications.createNotification('message.png', 'Привет Хабр!', 'Получили нотис. Трололо...') ).show();
// http://habrahabr.ru/post/155039/
@dshster
dshster / gist:3780198
Created September 25, 2012 05:48
jquery vertical align
jQuery.fn.valignMiddle = function(elem) {
var h = jQuery(this).height();
var h2 = jQuery(this).parent().height();
var pad = (h2-h)/2;
jQuery(this).css("padding-top", pad);
jQuery(this).css("padding-bottom", pad);
}
@dshster
dshster / uri.js
Created September 6, 2012 07:40 — forked from jlong/uri.js
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
// Originally solved by Tim Branyen in his drop file plugin
// http://dev.aboutnerd.com/jQuery.dropFile/jquery.dropFile.js
jQuery.event.props.push('dataTransfer');
@dshster
dshster / gist:3103740
Created July 13, 2012 08:51 — forked from sapegin/gist:925002
CSS3 Buttons in Springhare
/* Button */
button, input[type="submit"] {
display: inline-block;
padding: 2px 20px;
background: #c4c4c4;
background: -webkit-linear-gradient(top, #eee, #c4c4c4);
background: -moz-linear-gradient(top, #eee, #c4c4c4);
background: -ms-linear-gradient(top, #eee, #c4c4c4);
background: -o-linear-gradient(top, #eee, #c4c4c4);
background: linear-gradient(top, #eee, #c4c4c4);