Skip to content

Instantly share code, notes, and snippets.

View bjmiller121's full-sized avatar

BJ Miller bjmiller121

View GitHub Profile
@bjmiller121
bjmiller121 / isYo.js
Last active August 29, 2015 14:23
Console, Yo.
function isYo(thing) {
return thing !== undefined;
}
// Example Usage
var dawg = 1,
thing = "Thing",
nothing;
isYo(dawg); // true
@bjmiller121
bjmiller121 / bjmiller.peeps.yml
Last active August 29, 2015 14:18
Peeps Picker Profile
---
name: BJ Miller
email: bjmiller@tableau.com
favSkills:
- css
- js
- ux
- adminux
- drupal
- theme
@bjmiller121
bjmiller121 / npm-shrinkwrap.json
Created January 31, 2015 01:28
npm shrinkwrap for node-kss
{
"name": "kss",
"version": "1.3.0",
"from": "kss@>=1.3.0 <2.0.0",
"resolved": "https://registry.npmjs.org/kss/-/kss-1.3.0.tgz",
"dependencies": {
"async": {
"version": "0.9.0",
"from": "async@>=0.9.0 <0.10.0",
"resolved": "https://registry.npmjs.org/async/-/async-0.9.0.tgz"
@bjmiller121
bjmiller121 / iframe_defer.js
Created January 30, 2015 19:45
Defer loading of iframes
/**
* Defer iframe loading.
*
* Markup:
* <div class="defer-iframe" data-src="{SOURCE URL}" data-{ATTR}="{VAL}"></div>
*/
$(window).load( function(){
if ($('.defer-iframe').length) {
$('.defer-iframe').each( function() {
var $iframe = $('<iframe frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>');
@bjmiller121
bjmiller121 / SassMeister-input-HTML.html
Created January 23, 2015 03:50
Generated by SassMeister.com.
<div class="hexagon">
<h2>Sweet hex!</h2>
</div>
@bjmiller121
bjmiller121 / sass-hexagon.scss
Last active June 28, 2018 09:55
SASS Mixin to generate a hexagon in CSS
// Makes a CSS hexagon! based off of http://csshexagon.com/
// Demo: http://sassmeister.com/gist/98fcf3ce163a97d2ef7e
@mixin hexagon($size, $color, $border: 0) {
position: relative;
width: $size;
height: ($size * 0.577);
background-color: $color;
margin: ($size * 0.288) 0;
border-left: $border;
border-right: $border;
@bjmiller121
bjmiller121 / proportionate-iframe.css
Last active August 29, 2015 14:11
Proportionate iframe resize
/* Proportionately resize iframes. Add class to a wrapper around the iframe */
.iframe-4-3,
.iframe-16-9 {
position: relative;
padding-bottom: 75%; /* 4:3 */
height: 0;
}
.iframe-4-3 iframe,
.iframe-16-9 iframe {
position: absolute;
@bjmiller121
bjmiller121 / drupal_match_path.php
Created September 22, 2014 20:16
drupal_match_path() example
// https://api.drupal.org/api/drupal/includes!path.inc/function/drupal_match_path/7
$alias = drupal_get_path_alias(current_path());
$urls = array(
'example/url',
'example/url/*',
);
$patterns = implode("\n", $urls);
if (drupal_match_path($alias, $patterns)) {
@bjmiller121
bjmiller121 / simple-tooltips.css
Last active August 29, 2015 14:04
Simple CSS-only Tooltips
/*
* Simple Tooltip Styles
*
* Note: Works best with short, single-line tooltip content over a target that
* doesn't have a solid white background. Ideal for image tooltips.
*
* Example Markup:
*
* <div class="tooltip-target">
* <p>This is some content to hover over</p>
@bjmiller121
bjmiller121 / parseCount.js
Last active August 29, 2015 14:02
Simple function for parsing a number and creating a "pretty" formatted version such as 1.3k. Useful for things like social share counts.
/**
* Given a number or string, parses out the number and creates a "pretty"
* rounded version.
*
* @param {Number|String} raw - string or number to parse
* @return {Object} information about the passed number
* - {Number} number - cleaned up integer
* - {String} pretty - "pretty" formated number
* - {Number} digits - number of digets
*/