Skip to content

Instantly share code, notes, and snippets.

View snowman-repos's full-sized avatar

James snowman-repos

View GitHub Profile
@snowman-repos
snowman-repos / index.html
Created June 6, 2016 12:37
Load a custom style sheet for IE10 and 11
<link rel="stylesheet" href="app.css" id="js-app-css">
<script>
document.getElementById('js-app-css').setAttribute('href', 'ie10-11.css')
</script>
@snowman-repos
snowman-repos / client-hints-service-worker.js
Created January 4, 2016 08:28 — forked from deanhume/client-hints-service-worker.js
Service Worker & HTTP Client Hints
"use strict";
// Listen to fetch events
self.addEventListener('fetch', function(event) {
// Check if the image is a jpeg
if (/\.jpg$|.png$/.test(event.request.url)) {
// Inspect the accept header for WebP support
var supportsWebp = false;
@snowman-repos
snowman-repos / gist:914b5205288b2fbd7f49
Created September 7, 2015 02:28
Sublime key binding for converting to tabs
// requires the chain of command sublime plugin
// https://github.com/jisaacks/ChainOfCommand
[
{
"keys": ["shift+alt+a"],
"command": "chain",
"args": {
"commands": [
["set_setting", {"setting": "tab_size", "value": 2}],
["unexpand_tabs", {"set_translate_tabs" : true}],
@snowman-repos
snowman-repos / angular-js-disable-debug
Created December 31, 2014 13:47
AngularJS: Disable debug info
app.config(['$compileProvider', function ($compileProvider) {
// disable debug info
$compileProvider.debugInfoEnabled(false);
}]);
@snowman-repos
snowman-repos / vertical-align.styl
Created July 26, 2014 17:16
Vertically Align Anything Mixin
// Remember to set transform-style preserve-3d on
// the parent element of any that uses this mixin
vertical-align
position relative
top 50%
transform translateY(-50%)
@snowman-repos
snowman-repos / grid.styl
Created March 6, 2014 04:08
Semantic grid
/////////////////
// Semantic.gs // for Stylus: http://learnboost.github.com/stylus/
/////////////////
// Defaults which you can freely override
column-width = 60px
gutter-width = 20px
columns = 12
// Utility variable — you should never need to modify this
select#day(name="day", placeholder="Day")
option(value="1") 1
option(value="2") 2
option(value="3") 3
option(value="4") 4
option(value="5") 5
option(value="6") 6
option(value="7") 7
option(value="8") 8
option(value="9") 9
@snowman-repos
snowman-repos / countrylist.jade
Created March 3, 2014 13:28
country list dropdown
select#country(name="country")
option(value='AF') Afghanistan
option(value='AL') Albania
option(value='DZ') Algeria
option(value='AD') Andorra
option(value='AO') Angola
option(value='AG') Antigua and Barbuda
option(value='AR') Argentina
option(value='AM') Armenia
option(value='AU') Australia
@snowman-repos
snowman-repos / visually-hidden.styl
Created February 13, 2014 03:54
Visually hide an element
visuallyhidden()
clip rect(0 0 0 0)
clip rect(0, 0, 0, 0)
height 1px
margin -1px
overflow hidden
padding 0
position absolute
width 1px