Skip to content

Instantly share code, notes, and snippets.

View benjamincharity's full-sized avatar
🤖

Benjamin Charity benjamincharity

🤖
View GitHub Profile
/*
* Normalized hide address bar for iOS & Android
* (c) Scott Jehl, scottjehl.com
* MIT License
*/
(function( win ){
var doc = win.document;
// If there's a hash, or addEventListener is undefined, stop here
if( !location.hash && win.addEventListener ){
@benjamincharity
benjamincharity / demo.html
Created August 22, 2013 12:34
A slick CSS3 toggle to replace a checkbox.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Demo</title>
<link rel="stylesheet" href="css/screen.css">
</head>
<body>
@benjamincharity
benjamincharity / gzip.zsh
Last active December 21, 2015 22:18
Gzip a file into a new file, preserving the original.
gzip -c scripts.js > foo.gz
@benjamincharity
benjamincharity / spec-defaults.css
Last active December 23, 2015 00:09
CSS reset to browser defaults.
/*
http://www.w3.org/TR/CSS/#properties
http://www.w3.org/TR/css3-cascade/#initial0
http://dev.w3.org/csswg/css-cascade/#all-shorthand
*/
* {
@benjamincharity
benjamincharity / 1.selecterForOptionWithNgRepeat.js
Last active December 23, 2015 08:39
A directive to integrate Ben Plum's Selecter.js plugin with Angular.js.
//
// Bootstrap the jQuery select UX widget using 'Selecter.js' by Ben Plum
// http://www.benplum.com/formstone/selecter/
//
// Dependancies:
// Angular (duh)
// jQuery (required by selecter.js)
// Selecter.js
//
//
@benjamincharity
benjamincharity / SassMeister-input-HTML.html
Created November 13, 2013 14:44
Generated by SassMeister.com.
<div class="icon"></div>
@benjamincharity
benjamincharity / magicColors.scss
Created January 20, 2014 21:39
Avoid using a light text color over certain background colors. http://sassbin.com/gist/8529640/
@function checkLightness($color) {
@if ( (lightness($color) > 70) or (hue($color) > 40 and hue($color) < 200 )) {
@return #000000;
}
@else {
@return #FFFFFF;
}
}
@benjamincharity
benjamincharity / SassMeister-input-HTML.html
Created January 21, 2014 20:55
Generated by SassMeister.com.
<div>YOLO HOBO</div>
@benjamincharity
benjamincharity / SassMeister-input-HTML.html
Created January 31, 2014 19:30
Generated by SassMeister.com.
<div class="window">
<section></section>
<aside></aside>
</div>
@benjamincharity
benjamincharity / htmlEntities.js
Created February 14, 2014 14:45
Strip html entities with Javascript
// http://css-tricks.com/snippets/javascript/htmlentities-for-javascript/
function htmlEntities(str) {
return String(str).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
}