Skip to content

Instantly share code, notes, and snippets.

View mhairston's full-sized avatar

Michael Hairston mhairston

View GitHub Profile
@mhairston
mhairston / center-vertical-flex.css
Last active November 18, 2015 21:32
Better Center Vertical
.u-center-vertical-flex {
display: flex;
align-items: center;
}
/* to include IE10: */
.u-center-vertical-flex {
display: -ms-flex;
display: flex;
@mhairston
mhairston / center-vertical.css
Last active November 5, 2015 18:37
Vertically Center in 3 lines of CSS
/*
Vertically center
From http://csstricks.com
No styles needed on parent.
*/
.u-vertical-center {
position: relative;
top: 50%;
-webkit-transform: translateY(-50%);
@mhairston
mhairston / inline-break.css
Last active September 28, 2015 11:13
Insert line break after inline element
/*
Insert a line break after inline element
(not the same as display:block)
from CSS Secrets by Lea Verou
*/
.u-line-break::after {
content: '\A';
white-space: pre;
}
@mhairston
mhairston / hexagon.css
Created August 14, 2015 13:30
CSS Hexagon
/* From http://csshexagon.com, natch! */
.hexagon {
position: relative;
width: 300px;
height: 173.21px;
background-color: #64C7CC;
margin: 86.60px 0;
}
.hexagon:before,
@mhairston
mhairston / convert-to-array.js
Created July 29, 2015 17:20
Convert JS Array-like to Array
// Convert Array-like object to Array:
var unboundSlice = Array.prototype.slice;
var slice = Function.prototype.call.bind(unboundSlice);
function list() {
return slice(arguments);
}
var list1 = list(1, 2, 3); // [1, 2, 3]
@mhairston
mhairston / emoti.txt
Created July 28, 2015 18:51
extended emoticons
¯\_(ツ)_/¯
@mhairston
mhairston / jekyll-cheatsheet.html
Last active August 29, 2015 14:25
Jekyll cheats
Include
{% include footer.html %}
Include with params
{% include footer.html param="value" variable-param=page.variable %}
{{ site.time | date_to_string }}
07 Nov 2008
Include a gist -- filename optional.
@mhairston
mhairston / module-pattern.js
Created May 11, 2015 20:23
Module Pattern with Private Stuff
// Module pattern
ABC = ABC || {};
ABC.ModuleName = (function() {
function render_donut(el) {
dostuff();
}
function init(){
@mhairston
mhairston / grid-debug.html
Created April 7, 2015 20:02
grid-debugger
<style> .ns-newcsslib .grid--debug {outline: 5px solid #f00;height: 100px;} .ns-newcsslib .grid--debug [class^="col-"] {height:100%; background-color:#fee; display:block;}</style>
<div class="grid grid--debug"> <div class="col-1">&nbsp;</div> <div class="col-1">&nbsp;</div> <div class="col-1">&nbsp;</div> <div class="col-1">&nbsp;</div> <div class="col-1">&nbsp;</div> <div class="col-1">&nbsp;</div> <div class="col-1">&nbsp;</div> <div class="col-1">&nbsp;</div> <div class="col-1">&nbsp;</div> <div class="col-1">&nbsp;</div> <div class="col-1">&nbsp;</div> <div class="col-1">&nbsp;</div> </div>
@mhairston
mhairston / number-ball.html
Last active November 15, 2015 22:56
Big Orange Number Ball
<div style="background-color: #e64f35; border-radius: 50%; width: 160px; height: 160px; padding: 3px; margin: 2rem; border: 1rem solid #e64f35;color:#fff; font-size:3rem; text-align:center;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;">
<div>
56<small>%</small>
</div>
</div>