Skip to content

Instantly share code, notes, and snippets.

View NickDeckerDevs's full-sized avatar

nicholas decker NickDeckerDevs

View GitHub Profile
@NickDeckerDevs
NickDeckerDevs / timeout.js
Last active March 29, 2018 13:36
settimeout example to prevent item from happening 1000 times
var timer;
function load_and_resize() {
if($('.diagram-details').length > 0) {
$('.diagram-details .col-md-3').matchHeight({
property: 'min-height'
});
}
@NickDeckerDevs
NickDeckerDevs / fixphpini
Created April 19, 2018 10:13
Fixing issues with OSX Memory Limit in PHP for errors - composer
# Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 3582064 bytes) in phar:///usr/local/bin/wp/vendor/composer/composer/src/Composer/Cache.php on line 92
# Reverted composer.json.
# lets figure out why this is happening. If you are using regular command line, it is most likely controlled
# via the system and not mamp or anything, unless you have a different shell setup. So we need to adjust the
# system PHP
php -i | grep memory
# output may look like [memory_limit => 128M => 128M]
@NickDeckerDevs
NickDeckerDevs / slideout-cta.js
Created April 23, 2018 13:19
menu to sticky from relative and a slideout/in animation for an example of scrolling cta on side that slides outs
// for the movement and keeping it at a fixed position,
// set elbottom to the height of the screen or the place where you want it to stick
jQuery(function() {
var $window = jQuery(window),
$stickyEl = jQuery('.sidemenu'),
elTop = $stickyEl.offset().top,
elBottom = jQuery('.specials-wrapper').parent().next().offset().top - $stickyEl.height() - 20;
@NickDeckerDevs
NickDeckerDevs / pagination-class.js
Created April 24, 2018 09:48
paginations class js setup
// TODO: complete this object/class
// The constructor takes in an array of items and a integer indicating how many
// items fit within a single page
function PaginationHelper(collection, itemsPerPage) {
this.collection = collection;
this.itemsPerPage = itemsPerPage;
}
@NickDeckerDevs
NickDeckerDevs / gist:69c63f649863323f7c04f3b940119b6f
Created April 27, 2018 18:58
Wordpress Menu import into hubspot
Process Details:
1. Edit .htaccess file. On Wordpress website, edit .htaccess in the root directory to include the following:
mod_headers.c -- This may need to be added to apache. This is 99% of the time already loaded unless we get on some home grown servers (additional informaiton: http://stackoverflow.com/questions/8794566/how-to-check-mod-headers-and-mod-expires-modules-enabled-in-apache)
Access-Control-Allow-Origin -- This is the domain that you will allow to access your files. This should be the hubspot domain. If you are using a sandbox domain you will need
Access-Control-Allow-Methods -- This is the method you will be accessing the information from the domain. The most common method we should be using is "GET" (Additional Information: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Methods)
nvIf Origin are replacing dev.domain.com and the domain informaiton in the SetEnvIf doing multiple domains:
@NickDeckerDevs
NickDeckerDevs / pardot.js
Created April 30, 2018 16:29
Pardot subscription center / full circle
function uncheckAllCheckboxes(checkboxes) {
for(let i = 0; i < checkboxes.length; i++) {
let checkbox = checkboxes[i];
if(checkbox.getAttribute('id') != 'list_87018' ) {
checkbox.checked = false;
}
}
}
@mixin breakpoint($point) {
@if $point == desktopwide {
@media (min-width: 77em) {
@content ;
}
}
@else if $point == desktop {
@media (min-width: 64em) {
@content ;
}
@NickDeckerDevs
NickDeckerDevs / remove-orphans-es6.js
Created May 1, 2018 18:39
add nbsp to the last word of certain elements that you choose.
// target your items to be checked for oprhans,
// avoid header and footer areas to keep script quick
let contentToCheck = [
'.content-wrapper p',
'.content-wrapper h1',
'.content-wrapper h2',
'.content-wrapper h3',
'.content-wrapper h4'
];
@NickDeckerDevs
NickDeckerDevs / gulpfile.js
Created May 2, 2018 13:59
Gulpfile that copies complied Sass (CSS) file into your clipboard so you can paste it easily. Good setup for using global styles and modular elements like in the HubSpot Design Manager 2
/*
install instructions:
npm init -y
npm install username gulp gulp-sass gulp-rename gulp-sourcemaps sass-include-paths gulp-plumber gulp-notify gulp-postcss autoprefixer fs copy-paste gulp-cached
folder setup:
html/ // i like working on my code in my editor so I have this
gulpfile.js
node_modules/
@NickDeckerDevs
NickDeckerDevs / gulpfile.js
Last active May 7, 2018 20:42
sync with hubspot via ftp
//turned off so you don't accidently upload to the default portal
var syncWithHubspot = false;
var ftpFolder = '';
/* Gulp Variables */
const username = require('username');
var local = __dirname;
var directories = local.split('/');
var repo = directories[directories.length - 1];
var user = username.sync();