Skip to content

Instantly share code, notes, and snippets.

View wehrhaus's full-sized avatar

Justin Wehrman wehrhaus

View GitHub Profile
@wehrhaus
wehrhaus / triangle.styl
Created July 15, 2014 21:51
Stylus Triangle Generator
triangle(orientation, width, height, color)
if orientation == top
border-width 0 unit(width/2, px) unit(height, px) unit(width/2, px)
border-color transparent transparent color transparent
else if orientation == left
border-width unit(height/2, px) unit(width, px) unit(height/2, px) 0
border-color transparent color transparent transparent
else if orientation == bottom
border-width unit(height, px) unit(width/2, px) 0 unit(width/2, px)
border-color color transparent transparent transparent
@wehrhaus
wehrhaus / diamond.styl
Created July 15, 2014 21:52
Stylus Diamond Generator
diamond(width, dColor)
dWidth = unit(width, px)
display block
width dWidth;
height dWidth;
background dColor
position relative
top dWidth
transform rotate(-45deg)
transform-origin 0 100%
@wehrhaus
wehrhaus / For-Loop-Has-Own-Property.sublime-snippet
Created September 19, 2014 15:57
Sublime Snippet - sets up for loop with hasOwnProperty check and fix for IE8 support
<snippet>
<content><![CDATA[
/* IE8 fix for window.hasOwnProperty - set to ignore error from jshint */
/* jshint -W001 */
$2.hasOwnProperty = $2.hasOwnProperty || Object.prototype.hasOwnProperty;
for ($1 in $2) {
if ($2.hasOwnProperty($1)) {
console.log($2[$1]$0);
}
}
@wehrhaus
wehrhaus / YTVideoLoader.js
Last active August 29, 2015 14:07
YouTube iFrame Video Loader - Over simplifies working with the YouTube iFrame API
// # YTVideoLoader.js
// Doc: []
// ## Namespacing
// * Namespace YTVideoLoader Object
// ### Public Methods Available:
// * YTVideoLoader.confirmAPIReady()
// * YTVideoLoader.destroyPlayer()
// * YTVideoLoader.playerControl()
// * YTVideoLoader.buildPlayer()
@wehrhaus
wehrhaus / Solarized (Dark).tmTheme
Created October 13, 2014 03:11
Modified Solarized Dark Theme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Solarized (dark)</string>
<key>settings</key>
<array>
<dict>
<key>settings</key>
@wehrhaus
wehrhaus / _triangleGenerator.scss
Last active August 29, 2015 14:16
SCSS Triangle Generator
//----------------------------------------------------------------------
// Convert a number to specified unit
// @function unit
// @param {number} $num number to be converted to unit
// @param {string} $units unit number will be converted to
// @returns {string}
//----------------------------------------------------------------------
@function unit($num, $units) {
@return #{$num}#{$units};
}
@wehrhaus
wehrhaus / _linearGradientToSVG.scss
Created June 5, 2015 06:39
linearGradientToSVG SCSS Mixin
//----------------------------------------------------------------------
// Create a 2 color, linear gradient SVG image - default of vertical
// @function linearGradientToSVG
// @param {rgba} $colorA first color (top/left) of the gradient
// @param {rgba} $colorB second color (bottom/right) of the gradient
// @param {string} $orientation expects vertical or horizontal
// @returns {url}
//----------------------------------------------------------------------
@function linearGradientToSVG($colorA, $colorB, $orientation: vertical) {
@if $orientation == vertical {
@wehrhaus
wehrhaus / index.js
Created September 18, 2015 05:04
Exercises from the book, Functional JavaScript
var _ = require('lodash');
// var _ = require('underscore');
function existy(x) {
return x !== undefined && x !== null;
}
function truthy(x) {
return x !== false && existy(x);
}
@wehrhaus
wehrhaus / Preferences.sublime-settings
Last active November 14, 2016 16:37
Sublime Text Preferences.sublime-settings
{
"always_show_minimap_viewport": true,
"bold_folder_labels": true,
"caret_extra_width": 1,
"caret_style": "phase",
"color_scheme": "Packages/User/SublimeLinter/Material-Theme-OceanicNext (SL).tmTheme",
"default_line_ending": "unix",
"font_face": "Hack",
"font_size": 10,
"highlight_line": true,
@wehrhaus
wehrhaus / gist:f4fef8d188301cc07a20
Created January 20, 2016 17:32
Directive Example using setValidation
(function() {
'use strict';
angular
.module('jpmTool.components')
.directive('datePicker', datePicker);
function datePicker() {
return {
scope: {