Skip to content

Instantly share code, notes, and snippets.

View eljamez's full-sized avatar
🕶️
Good Times

James Augustus Hall eljamez

🕶️
Good Times
View GitHub Profile
@eljamez
eljamez / index.html
Created May 4, 2020 22:57
Quick Grid Page Layout
<div class="grid">
<header>Header</header>
<aside>Aside</aside>
<main>Main</main>
<footer>Footer</footer>
</div>
@eljamez
eljamez / pr.md
Last active May 10, 2019 14:12
PR Template

Description

Description of changes

Ticket

ticket number

Dependencies

None

Screenshot

( add screenshot here )

@eljamez
eljamez / getUrlParamsObj.js
Created June 19, 2018 21:02
ES6 friendly function to retrieve url parameters as an Object.
const getUrlParamsObj = (queryString) => {
const paramsArray = (window.location.search.charAt(0) === "?")
? window.location.search.substr(1).split('&')
: window.location.search.split('&')
return paramsArray.reduce((mainObj, val) => {
const valArray = val.split('=')
return Object.assign(mainObj, {[valArray[0]]: valArray[1]})
}, {})
}
@eljamez
eljamez / concat.js
Last active December 10, 2017 22:43
es6 spread and concat, add to array of objects.
const myObj = {
list: [
{name: 'bill'},
{name: 'fred'}.
],
};
const newObj = {
...myObj,
list: myObj.list.concat({name: 'sam'})
@eljamez
eljamez / animateElementMethod.js
Created December 10, 2015 21:17
animate.css "animateElement" method for an ES2015 Class
// A method withn an es2015 Class
// requires animate.css (https://daneden.github.io/animate.css/)
// animation defaults to "pulse"
// call it, watch animation, end event binds and unbinds after one use, removing animate classes.
animateElement($element, animationType) {
// animate.css animate type
animationType = animationType || "pulse";
let animationClasses = 'animated ' + animationType;
let animationEnd = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend';
$element.addClass(animationClasses).one(animationEnd,function() {
@eljamez
eljamez / Breakpoint Mixins
Created February 3, 2015 18:13
Breakpoint Mixins for SCSS for easy setup.
// 1120px
@mixin bp-xlarge {@media only screen and (min-width: 80em) {@content;}}
// 960px
@mixin bp-large {@media only screen and (min-width: 64em) {@content;}}
// 640px
@mixin bp-medium {@media only screen and (min-width: 40em) {@content;}}
// 480px
@mixin bp-small {@media only screen and (min-width: 30em) {@content;}}
// special for header (840px)
@mixin bp-header {@media only screen and (min-width: 53em){@content;}}
@eljamez
eljamez / hero-paralax
Last active December 31, 2015 08:49
Quick bit for initiating a background image paralax on a large image (hero) that is at the top of your page. (NEEDS WORK)
# Still working on this.
# the element with the class 'hero-paralax' will be targeted, setting the variable
$hero_paralax = $('.hero-paralax')
# watching for scrolling
$(@).scroll () =>
# set scroll top position
scroll_top = $(@).scrollTop()
# set new bg position (moves down at half the speed of scrolling
@eljamez
eljamez / get_scroll_top.coffee
Last active December 29, 2015 08:49
Just a quick snip that returns the scroll position of the page.
# start at the top
scroll_top = 0
# on the scroll
$(@).scroll () =>
scroll_top = $(@).scrollTop()
# log it
console.log scroll_top
@eljamez
eljamez / switch.coffee
Created September 12, 2013 18:02
CoffeeScript switch example (for quick reference)
# just copy and paste and you have the quick bones for a CoffeeScript Swtich statement
# 'day' is the variable you are checking
switch day
when "Fri" then 'yeah'
else 'dang'
@eljamez
eljamez / functions.php
Created August 28, 2013 17:49
Woocommerce, get the product's attribute title from attribute slug
// just pass in the attribute and the attribute slug
// and the return value is the attribute's name
// example : (assuming attribute size has the option of "Extra Small" withe the slug of "extra-small")
// echo attribute_slug_to_title('attribute_pa_size', 'extra-small');
// returns
// "Extra Small"
// code reworked from woocommerce/classes/class-wc-cart.php