Skip to content

Instantly share code, notes, and snippets.

View codenamezjames's full-sized avatar

James Harrington codenamezjames

View GitHub Profile
/**
* Usage reorderStates('#txtState')
* .getArrayOfOptionAttrs()
* .orderByUsa()
* .renderOptions();
*/
var reorderStates = (function($){
var canadaStates = ['Alberta', 'British Columbia', 'Manitoba', 'New Brunswick',
'Newfoundland & Labrador', 'Nova Scotia', 'Ontario', 'Prince Edward Island',
/* jshint sub: true */
/**
* Usage reorderStates('#txtState')
* .getArrayOfOptionAttrs()
* .orderByUsa()
* .renderOptions();
*/
app.directive('dynamicYoutubeEmbed', function($window){
return {
restrict: 'A', // E = Element, A = Attribute, C = Class, M = Comment
link: function($scope, iElm, iAttrs, controller) {
var $video = $(iElm);
var $fluidEl = $video.parent();
var aspectRatio = Number(iAttrs.height) / Number(iAttrs.width);
$video.removeAttr('height').removeAttr('width');
(function (root) {
var jlib;
var jcore = {};
var jtypes = Object.create(jcore);
var defaults = {};
var TYPES = ['Arguments', 'Array', 'Boolean', 'Date', 'Error', 'Function', 'Null', 'Number', 'Object', 'RegExp', 'Map', 'Symbol', 'String', 'Undefined'];
jlib = function(subject) {
var type = jlib.typer(subject);
var j;
jtypes[type] = jtypes[type] || {};
@codenamezjames
codenamezjames / headerpadding.js
Created January 28, 2016 20:54
This snip adds header height to the padding of anchor links
(function($){
$(function(){
var headerHeight = 0;
$(window).on('resize, scroll', function(){
if (headerHeight === $('header').height()){ return false; }
headerHeight = $('header').height();
changeAnchorPadding(headerHeight);
(function ($) {
$(function () {
$('.secondaryNavList a').each(function () {
function replaceBetween(str, what, start, end) {
return str.substring(0, start) + what + str.substring(end);
}
var href = $(this).attr('href');
var shouldAlter = (href.match(/\/category\//g).length > 1);
if (shouldAlter) {

I Love You!!!! -James

#!/usr/bin/env bash
nodeVersion="5.0";
echo "###############################################################"
echo "###############################################################"
echo "Installing NVM, Node version $nodeVersion and the latest version of gulp"
echo "###############################################################"
echo "###############################################################"
<div class="swatch selected" data-color-id="2521">
<label>
<img src="/Product_Images/570162911_2521_s.gif" alt="Blue Grotto" width="25" height="25">
</label>
</div>
arr = [];
$('.forum_header_noborder tr').each(function(){
var title = $(this).find('.epinfo').text();
var link = $(this).find('.magnet').attr('href')
arr.push({title:title,link:link})
})
arr.forEach(function(ar){
var match = ar.title.match(/S0\dE\d\d/)
ar.title = match ? match[0] : ar.title