Skip to content

Instantly share code, notes, and snippets.

Shaw shshaw

Block or report user

Report or block shshaw

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View module-es2015.js
const Application = ((d) => {
const privateVariable = 'Private content'
const __private = {
cache: () => {
this.link = d.querySelector('.link')
},
bind: () => {
this.link.addEventListener('click', this.showContent, false)
@raybellis
raybellis / jquery.classlist.js
Last active Dec 14, 2015
A shim for jQuery that uses the native "classList" property of an element for class modifications, if available.
View jquery.classlist.js
/*global jQuery */
;(function($) {
/*global document */
"use strict";
if (typeof document !== 'undefined' && ('classList' in document.createElement('a'))) {
var $ = jQuery;
@edwinwebb
edwinwebb / gist:5155504
Last active Feb 1, 2019
A simple less loop with comments and simple from, to syntax.
View gist:5155504
/* Define two variables as the loop limits */
@from : 0;
@to : 10;
/* Create a Parametric mixin and add a guard operation */
.loop(@index) when(@index =< @to) {
/* As the mixin is called CSS is outputted */
div:nth-child(@{index}) {
top: unit(@index * 100, px);
View modernizr.shaw.js
Modernizr.testStyles('#modernizr { height: 50px; width: 50px; margin: auto; position: absolute; top: 0; left: 0; bottom: 0; right: 0; display: table; }', function(elem, rule) {
Modernizr.addTest('shaw', Math.round(window.innerHeight / 2 - 25) === elem.offsetTop);
});
@joaocunha
joaocunha / How To Hide The Select Arrow On Firefox.md
Last active Dec 21, 2019
How to hide <select> dropdown's arrow in Firefox when using "-moz-appearance: none;".
View How To Hide The Select Arrow On Firefox.md

This is no longer a bug. I'm keeping the gist for historical reasons, as it helped to get it fixed. Make sure to read the notes by the end of the post.

How to remove hide the select arrow in Firefox using -moz-appearance:none;

TL;DR (or, the fix)

  1. Set -moz-appearance to none. This will "reset" the styling of the element;
  2. Set text-indent to 0.01px. This will "push" the text a tiny bit[1] to the right;
@PaulKinlan
PaulKinlan / criticalcss-bookmarklet-devtool-snippet.js
Last active Jan 25, 2020
CriticalCSS Bookmarklet and Devtool Snippet.js
View criticalcss-bookmarklet-devtool-snippet.js
(function() {
var CSSCriticalPath = function(w, d, opts) {
var opt = opts || {};
var css = {};
var pushCSS = function(r) {
if(!!css[r.selectorText] === false) css[r.selectorText] = {};
var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/);
for(var i = 0; i < styles.length; i++) {
if(!!styles[i] === false) continue;
var pair = styles[i].split(": ");
View 01. vertical and horizontal centering
.Absolute-Center {
margin: auto;
position: absolute;
top: 0; left: 0; bottom: 0; right: 0;
}
@maxfenton
maxfenton / a-new-mac-setup.md
Last active Nov 18, 2019
System setup stuff for a new mac
View a-new-mac-setup.md

New computer setup

a/o 2019-03-18

--

Format the drive

  1. Restart with Cmd-R or Cmd-D
  2. Erase drive / 3x if second-hand
  3. Reinstall MacOS
@davidmh
davidmh / custom-post-type-archive-menu-links.php
Last active Oct 14, 2016 — forked from helgatheviking/custom-post-type-archive-menu-links.php
Adds Custom Post Type archives to the WordPress-powered menus. Compatible with WP 3.8
View custom-post-type-archive-menu-links.php
<?php
/*
Plugin Name: Custom Post Type Archive Menu Links
Plugin URI: http://codeseekah.com/2012/03/01/custom-post-type-archives-in-wordpress-menus-2/
Description: Easily Add Custom Post Type Archives to the Nav Menus
Version: 1.1
Author: soulseekah
Author URI: http://codeseekah.com
License: GPL2
@branneman
branneman / svg-classes.js
Created Jan 15, 2014
SVG — hasClass, addClass, removeClass, toggleClass
View svg-classes.js
//
// SVG — hasClass, addClass, removeClass, toggleClass
// Source:
// https://gist.github.com/branneman/8436956
// Taken and adapted from:
// http://toddmotto.com/hacking-svg-traversing-with-ease-addclass-removeclass-toggleclass-functions/
//
if (SVGElement && SVGElement.prototype) {
You can’t perform that action at this time.