Skip to content

Instantly share code, notes, and snippets.

View danielmatthew's full-sized avatar

Dan Matthew danielmatthew

View GitHub Profile
@danielmatthew
danielmatthew / gist:9205095
Created February 25, 2014 08:32
Reduces element margin on scroll. Useful with fixed element.
$(window).scroll(function()
{
$("#phone").css("margin-top",Math.max(0,970-$(this).scrollTop()));
});
}
@danielmatthew
danielmatthew / sass-mq
Created April 30, 2015 12:15
Sass MQ Mixin
$medium-screen: 30em;
$big-screen: 50em;
@mixin medium {
@media (min-width: #{$medium-screen}) and (max-width: #{$big-screen} - 1px) {
@content;
}
}
@mixin large {
@danielmatthew
danielmatthew / .csscomb.json
Last active August 29, 2015 14:26
Preferred CSScomb settings
{
"remove-empty-rulesets": true,
"always-semicolon": true,
"color-case": "lower",
"block-indent": " ",
"color-shorthand": true,
"element-case": "lower",
"eof-newline": true,
"leading-zero": true,
"quotes": "double",
@danielmatthew
danielmatthew / smooth.css
Created July 6, 2012 09:51
Smooths transitions between media query breakpoints
transition: all .3s ease-out;
-webkit-transition: all .3s ease-out;
-moz-transition: all .3s ease-out;
-o-transition: all .3s ease-out;
@danielmatthew
danielmatthew / mobile-meta
Created July 9, 2012 14:09
Meta tags to make site mobile friendly
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
@danielmatthew
danielmatthew / index.html
Created August 13, 2012 12:24
New HTML5 site boilerplate
<!DOCTYPE>
<html>
<head>
<title></title>
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<link rel="stylesheet" type="text/css" href="stylesheets/screen.css">
@danielmatthew
danielmatthew / gist:730c60ac76a55fcbc66c
Created November 1, 2015 15:12
Sync master and gh-pages
#[remote "origin"]
push = +refs/heads/master:refs/heads/gh-pages
push = +refs/heads/master:refs/heads/master
@danielmatthew
danielmatthew / gist:6351319
Created August 27, 2013 09:03
JavaScript snippet to add in appropriate meta tag after page has loaded
var meta;
if (document.createElement && (meta = document.createElement('meta'))) {
meta.name = 'format-detection';
meta.content = 'telephone=no';
document.getElementsByTagName('head')[0].appendChild(meta);
}
@danielmatthew
danielmatthew / linked-list
Created January 22, 2014 16:01
The essence of a linked list in JavaScript
// A single node
var node1 = {
data: null,
next: null
};
// Add data to node
node1.data = 12;
// Create another node
{
"bold_folder_labels": true,
"caret_extra_bottom": 2,
"caret_extra_top": 2,
"caret_extra_width": 3,
"caret_style": "phase",
"color_scheme": "Packages/Theme - Cobalt2/cobalt2.tmTheme",
"create_window_at_startup": false,
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,