Skip to content

Instantly share code, notes, and snippets.

View benjamincharity's full-sized avatar
🤖

Benjamin Charity benjamincharity

🤖
View GitHub Profile
@benjamincharity
benjamincharity / customTransition.css
Last active December 12, 2015 03:38
Humanistic CSS Transition
-webkit-transition: all 300ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-moz-transition: all 300ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-ms-transition: all 300ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
-o-transition: all 300ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
transition: all 300ms cubic-bezier(0.26, 0.86, 0.44, 0.985);
@benjamincharity
benjamincharity / rem.scss
Last active December 12, 2015 05:58 — forked from raybrownco/rem.scss
REM is a SCSS mixin that converts pixel values to REM values for whatever property is passed to it.
/*
* 'rem' is a Sass mixin that converts pixel values to rem values for whatever property is passed to it.
* It returns two lines of code — one of the regular pixel values (for IE), and another with the
* converted rem values (for everyone else). Special thanks to Chris Epstein (http://chriseppstein.github.com)
* and Martin Bavio (http://martinbavio.com) for the help and code!
*
* Sample input:
* .element {
* @include rem('padding',10px 0 2px 5px);
* }
@benjamincharity
benjamincharity / skipMobileNavBar.js
Created February 16, 2013 16:16
Remy Sharp's solution to hiding the mobile nav bar without affecting desktop browsers.
// Original Author: Remy Sharp - http://remysharp.com/2010/08/05/doing-it-right-skipping-the-iphone-url-bar/
/mobi/i.test(navigator.userAgent) && !location.hash && setTimeout(function () {
if (!pageYOffset) window.scrollTo(0, 1);
}, 1000);
@benjamincharity
benjamincharity / _docTemplate.scss
Last active December 13, 2015 20:08
The SCSS file documentation template. This goes at the top of your SCSS file.
//
//
//
// $TITLE
//
//
// @author Your Name <your@email.com>
//
// @doc
// __documentation__
@benjamincharity
benjamincharity / clearMixin.scss
Created February 16, 2013 17:49
Micro clearfix hack SCSS mixin.
// Micro clearfix hack
// http://nicolasgallagher.com/micro-clearfix-hack/
@mixin clear {
&::before, &::after {
content: "\0020";
display: table;
}
&:after { clear: both; }
@if $ie7-support {
& { zoom: 1; }
@benjamincharity
benjamincharity / customTransition.scss
Created February 16, 2013 17:59
Custom cubic-bezier transition. Much more humanistic than easing etc.
// Custom cubic-bezier transition - much more humanistic than easing etc
//
// Usage:
// This function can be passed a) property and b) timing.
//
// div {
// @include customTransition(opacity, 1000ms);
// }
//
// Which would output:
@benjamincharity
benjamincharity / createProject.sctp
Last active December 14, 2015 07:09
Script for AlfredApp to create a new project. Pulls in my boilerplate, curls latest scripts, sets up rvm, sets up git, create initial commit, add the remote repo and fix auth issue.
# @Auth Benjamin Charity - ben@benjamincharity.com
#
# Add this script to AlfredApp.
# If you set the trigger word to 'create' then you would
# open alfred and type 'create foobar'. When you hit enter
# this script will run and a new project will be created
# in the location specified.
#
# Then, on Github, create a repo with the exact same name
# that you typed in the initial command. The project will
# Grep for the phrase 'TODO' in SCSS files (simply omit everything
# after the last star to search all file types. The 'j' option stops
# the cursor from automatically jumping to the first instance.
:vimgrep TODO/j **/*.scss
# Open a pane showing all instances.
:cw
@benjamincharity
benjamincharity / base64
Last active December 14, 2015 15:29
Copy the Base64 code for an image from the command line.
# change the image reference as needed (logo.svg)
echo -n `cat logo.svg` | base64 | pbcopy
@benjamincharity
benjamincharity / iOSStartupScreens.html
Created March 21, 2013 20:08
Specify different startup screens for various devices.
<!-- iPhone -->
<link href="http://www.example.com/mobile/images/apple-startup-iPhone.jpg" media="(device-width: 320px) and (device-height: 480px) and (-webkit-device-pixel-ratio: 1)" rel="apple-touch-startup-image">
<!-- iPhone (Retina) -->
<link href="http://www.example.com/mobile/images/apple-startup-iPhone-RETINA.jpg" media="(device-width: 320px) and (device-height: 480px) and (-webkit-device-pixel-ratio: 2)" rel="apple-touch-startup-image">
<!-- iPhone 5 -->
<link href="http://www.example.com/mobile/images/apple-startup-iPhone-Tall-RETINA.jpg" media="(device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2)" rel="apple-touch-startup-image">
<!-- iPad Portrait -->