Skip to content

Instantly share code, notes, and snippets.

View MarcusJT's full-sized avatar

Marcus MarcusJT

View GitHub Profile
* {
-webkit-box-sizing: border-box; /* Safari < 5.1, Chrome < 10 */
-moz-box-sizing: border-box; /* Firefox, other Gecko */
box-sizing: border-box; /* Opera/IE 8+/Safari5.1+/Chrome 10+ */
}
@matthewcrist
matthewcrist / gist:2353575
Created April 10, 2012 18:40
CSS3 translate3d for WebKit
selector {
-webkit-transform: translate3d(0,0,0);
}
@rodneyrehm
rodneyrehm / demo-list.html
Created May 28, 2012 11:08
jQuery Snippets - jQuery.sortChildren()
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>sorting lists</title>
<script src="jquery-1.7.2.min.js"></script>
<script src="jquery.sortChildren.js"></script>
<script>
(function($){
function dragEnter(e) {
$(e.target).addClass("dragOver");
e.stopPropagation();
e.preventDefault();
return false;
};
function dragOver(e) {
e.originalEvent.dataTransfer.dropEffect = "copy";
@maskingtape
maskingtape / dabblet.css
Created March 21, 2013 14:08
SVG Data URI Background borders
/**
* SVG Data URI Background borders
*/
body{
background: #fff;
min-height: 100%;
font-family: sans-serif;
}
@maskingtape
maskingtape / scriptLoader.js
Created March 25, 2013 10:20
HTML5 boilerplate google analytics script loader generalised to include the font loader
var _gaq=[['_setAccount','UA-XXXXXXX-X'],['_trackPageview']],
WebFontConfig = { google: { families: [ 'Marvel::latin' ]}};
(function(d,t){
function addScript(p, url){
var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
g.src=('https:'==location.protocol?p.s:p.n)+url;
s.parentNode.insertBefore(g,s);
}
addScript({ s: '//ssl', n: '//www'}, '.google-analytics.com/ga.js');
addScript({ s: 'https', n: 'http'}, '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js');
@alastaircoote
alastaircoote / gist:5384053
Created April 14, 2013 20:19
Hashchange event hook
var hashChange = function() {
var el = document.getElementById(window.location.hash.substr(1));
$(".activeTr").removeClass("activeTr").find("td").css({
"background":"",
"color":""
});
$(el).parent().addClass("activeTr").find("td").css({
"background":"#08c",
"color":"#fff"
@HoundstoothSTL
HoundstoothSTL / anchor-scroll-with-offset.js
Created May 3, 2013 15:43
Anchor scroll with fixed header offset
(function($) {
$('a[href*=#]:not([href=#])').click(function()
{
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
|| location.hostname == this.hostname)
{
var target = $(this.hash),
headerHeight = $(".primary-header").height() + 5; // Get fixed header height
@JeffJacobson
JeffJacobson / google-analytics-honor-doNotTrack.js
Last active October 26, 2018 21:11
Google Analytics setup respecting navigator.doNotTrack.
// Setup Google Analytics, but not if user has specified that they don't want to be tracked.
(function (dnt, cookieDomain) {
var scriptTag, hostRe = new RegExp(cookieDomain.replace(".", "\\.") + "$");
if (dnt !== "yes" && dnt !== "1") {
window.ga = window.ga || function () { (ga.q = ga.q || []).push(arguments) }; ga.l = +new Date;
ga('create', 'YOUR-ID-HERE', hostRe.test(location.host) ? cookieDomain : "auto");
ga(function (tracker) {
tracker.set("appName", "Your app name here");
tracker.send('pageview');
});
@tedw
tedw / fancy-underline.scss
Last active January 2, 2020 20:59
Fancy Link Underlines ala Medium.com – https://medium.com/designing-medium/7c03a9274f9
// Requires Bourbon
@import "bourbon/bourbon";
// Use CSS gradient and text shadow to create line that breaks for descenders
// Inspired by https://medium.com/designing-medium/7c03a9274f9
@mixin fancyUnderline( $color: currentColor, $bgcolor: #fff ) {
@include background-image( linear-gradient( to bottom, $bgcolor 50%, $color 50% ) );
background-position: 0 89%;
background-repeat: repeat-x;
background-size: 1px 1px;