This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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;}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// get the current user name from anywhere | |
// paste into functions.php | |
if ( ! function_exists( 'get_user_name' ) ) { | |
function get_user_name() { | |
global $current_user; | |
get_currentuserinfo();//populates current user var/object | |
$current_visible_name = $current_user->user_firstname; | |
if($current_visible_name == '') { | |
$current_visible_name = $current_user->display_name; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ () -> #jQuery starter upper! | |
# browser window var | |
$browser_window = $(window) | |
# function | |
window_info = -> | |
console.log '----------------BROWSER WIDTH AND HEIGHT-------------------' | |
console.log $browser_window.width()+' is the browser width || '+$browser_window.height()+' is the browser height' | |
# function call | |
window_info() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// usage | |
// just call rekey_array_keys_to_defaults( $my_array ); | |
// this function call will return the same array in the same order | |
// but with new keys. The new keys are the default array keys | |
// i.e. [0,1,2] | |
function rekey_array_keys_to_defaults($array_to_rekey) { | |
$rekeyed_array = array(); | |
foreach ($array_to_rekey as $key => $value) { | |
array_push($rekeyed_array, $value); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# start at the top | |
scroll_top = 0 | |
# on the scroll | |
$(@).scroll () => | |
scroll_top = $(@).scrollTop() | |
# log it | |
console.log scroll_top |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const myObj = { | |
list: [ | |
{name: 'bill'}, | |
{name: 'fred'}. | |
], | |
}; | |
const newObj = { | |
...myObj, | |
list: myObj.list.concat({name: 'sam'}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]}) | |
}, {}) | |
} |
OlderNewer