Skip to content

Instantly share code, notes, and snippets.

View ackernaut's full-sized avatar

Terry Acker ackernaut

View GitHub Profile

Keybase proof

I hereby claim:

  • I am ackernaut on github.
  • I am ackernaut (https://keybase.io/ackernaut) on keybase.
  • I have a public key ASDh34Vswpw7tnWdkirjceTgwFUP3WNvQpSlboNFKAoqdwo

To claim this, I am signing this object:

@ackernaut
ackernaut / randomUnsplash.js
Created August 17, 2016 20:02
Get random image from unsplash
// Requires jQuery or Zepto
// Get Random Image (unsplash.it)
var jsRandomImg = $('.js-random-img');
function getRandomIntInclusive(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
}
@ackernaut
ackernaut / _mq-high-res.scss
Created July 22, 2016 18:45
Sass media query for high resolution (with optional min-width version)
// _mq-high-res.scss
@mixin mq-high-res {
@media only screen and (-webkit-min-device-pixel-ratio: 1.3),
only screen and (-o-min-device-pixel-ratio: 13/10),
only screen and (min-resolution: 120dpi)
{
@content;
}
:first-child i === 0
:last-child i === arr.length - 1
:only-child arr.length === 1
:nth-child(even) i % 2
:nth-child(odd) !(i % 2)
:nth-child(n) i === n - 1
:nth-last-child(n) i === arr.length - n
@ackernaut
ackernaut / _breakpoints-fibonacci.scss
Last active August 29, 2015 14:22
Breakpoints on a Fibonacci scale
// Breakpoints on a Fibonacci scale
// --------------------------------
$bp-s0-min: 0px;
$bp-s0-max: 99px;
$bp-s1-min: 100px;
$bp-s1-max: 199px;
$bp-s2-min: 200px;
$bp-s2-max: 299px;
$bp-s3-min: 300px;
@ackernaut
ackernaut / ios-dimension-vars.less
Created December 7, 2012 16:42
LESS variables for iOS device dimensions
// iOS Device Dimensions
@iPadLandHeight: 768px;
@iPadPortHeight: 1024px;
@iPadLandWidth: 1024px;
@iPadPortWidth: 768px;
@iPhoneLandHeight: 320px; // 640 / 2
@iPhonePortHeight: 480px; // 960 / 2
@ackernaut
ackernaut / detection.js
Created October 31, 2012 14:36
Detect platforms, devices, etc.
// File: detection.js
(function($){
var htmlAttr = document.documentElement;
var ua = navigator.userAgent.toLowerCase();
// Global variables
isiPhone = ua.indexOf("iphone") > -1;
isiPad = ua.indexOf("ipad") > -1;
@ackernaut
ackernaut / brand-colors.less
Created September 26, 2012 02:38
BrandColors as LESS variables
// BrandColors
// Curated by: Galen Gidman
// http://galengidman.com/brandcolors/
// LESS CSS Variables
// Using @bc'BrandColor' as naming convention
// LESS file by @ackernaut
@bcAboutMeBlue: #00405d;
@bcAboutMeYellow: #ffcc33;
@ackernaut
ackernaut / border-box-sizing.css
Created April 16, 2012 20:35
CSS: Border-box sizing
// Border-box sizing
.box-sizing {
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
@ackernaut
ackernaut / text-overflow.css
Created April 16, 2012 20:29
CSS: Text overflow with ellipsis
/* Seen in jQuery Mobile, Twitter's Bootstrap, etc. */
/* Requires inline-block or block for proper styling */
.text-overflow {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}