Skip to content

Instantly share code, notes, and snippets.

@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);
// 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 / 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"
@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 / 1.1_directory_structure.txt
Created November 21, 2012 18:32 — forked from latentflip/1.1_directory_structure.txt
In Lieu of doing this properly
./frontend
├── /coffee
│   ├── /models
│   | └── MyBaseModel.coffee
│   | └── MyModel.coffee
│   ├── /routers
│   | └── MyRouter.coffee
│   ├── /templates
| │   ├── /tmpl-dir1
@dshster
dshster / gist:4126744
Created November 21, 2012 18:37 — forked from ajpiano/gist:2570733
grunt "indexcss" task
grunt.registerMultiTask("cssindex", "Create an 'index' file of css @import rules for sitewide CSS", function() {
var file = grunt.file;
var target = this.target;
var fileHandles = this.data.map(function( glob ) {
return file.expand( glob );
});
var imports;
fileHandles = fileHandles.concat.apply( [], fileHandles );
@dshster
dshster / grunt.js
Created November 21, 2012 18:43 — forked from vojtajina/grunt.js
Grunt script for inlining AngularJS templates
module.exports = function(grunt) {
grunt.initConfig({
inline: {
'index.html': ['tpl/*.html']
}
});
grunt.registerMultiTask('inline', 'Inline AngularJS templates into single file.', function() {
var SCRIPT = '<script type="text/ng-template" id="<%= id %>"><%= content %></script>\n';
@dshster
dshster / grid.svg
Created December 14, 2012 05:38 — forked from pepelsbey/grid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
HTMLTextAreaElement.prototype.getCaretPosition = function () { //return the caret position of the textarea
return this.selectionStart;
};
HTMLTextAreaElement.prototype.setCaretPosition = function (position) { //change the caret position of the textarea
this.selectionStart = position;
this.selectionEnd = position;
this.focus();
};
HTMLTextAreaElement.prototype.hasSelection = function () { //if the textarea has selection then return true
if (this.selectionStart == this.selectionEnd) {

Styling native elements

Native HTML controls are a challenge to style. You can style any element in the web platform that uses Shadow DOM with a pseudo element ::pseudo-element or the /deep/ path selector.

video::webkit-media-controls-timeline {
  background-color: lime;
}

video /deep/ input[type=range] {