Skip to content

Instantly share code, notes, and snippets.

View NickDeckerDevs's full-sized avatar

nicholas decker NickDeckerDevs

View GitHub Profile
@NickDeckerDevs
NickDeckerDevs / slider.scss
Created August 16, 2018 14:16
hs slider scss
@import '../variables';
.slider-with-header {
.max-width-container {
@include breakpoint(desktopwideup) {
max-width: 1200px;
}
}
.flexslider {
float: left;
@NickDeckerDevs
NickDeckerDevs / hubspotform.js
Created August 16, 2018 21:33
node js hubspot form submission using http request
// We need this to build our post string
const querystring = require('querystring');
const http = require('http');
const https = require('https');
function getFormData(data) {
var hsFormData = JSON.stringify({
"fields": [{
"name": "email",
"value": data.email
// window load waits until after CTAs and forms are in DOM
$(window).load(function() {
// check to see if this exists on the page by checking out how many exist
if($('.post-footer-cta-wrapper #cta_button_112139_572acb38-75c4-4b31-ba14-d52e28378911').length > 0) {
//set up click event handler
$('.post-footer-cta-wrapper #cta_button_112139_572acb38-75c4-4b31-ba14-d52e28378911').on('click', function() {
// after being clicked we return false, preventing the default behavior of the element.
// in this case it is a link, so it prevents the link from functioning
return false;
});
@NickDeckerDevs
NickDeckerDevs / wordpress-hubspot-embed-shortcode.php
Created September 10, 2018 14:50
shortcode to use hubspot embed in wordpress sites to make sure JS doesn't move your form below the footer
function get_hubspot_form_embed( $atts ) {
// to use this embed code follow this:
// [hubspot_form form_id='{{ hubspot form id }}']
// [hubspot_form form_id='ca34cd96-d5b2-4dc4-b412-f7fc6f73abc4']
// uses a random class to keep this form targeted
$a = shortcode_atts( array(
'form_id' => '',
), $atts );
$rand = 'form-class-' . substr(md5(microtime()),rand(0,26),9);
$form = '<div class="' . $rand . ' insert-form hbspt-form"></div>';
@NickDeckerDevs
NickDeckerDevs / webdev_online_resources.md
Created October 9, 2018 13:19 — forked from bradtraversy/webdev_online_resources.md
Online Resources For Web Developers (No Downloading)
@NickDeckerDevs
NickDeckerDevs / inlineformdownload.html
Created October 9, 2018 16:34
Hubspot inline form download module: S2M - CTA BG Image
<h3>The 10 Must-Ask Questions Before You Hire A Digital Agency</h3>
<!--[if lte IE 8]>
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2-legacy.js"></script>
<![endif]-->
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js"></script>
<script>// <![CDATA[
hbspt.forms.create({
css: '',
portalId: '#####',
formId: '#############################',
@NickDeckerDevs
NickDeckerDevs / consolelove.js
Created October 19, 2018 00:35
print all links in wordpress sitemap page in console
var links = document.querySelectorAll('#sitemap td a');
[].forEach.call(links, function(link) {
console.log(link.href)
});
@NickDeckerDevs
NickDeckerDevs / mixin.scss
Created November 16, 2018 20:50
fluid type mixin
@mixin fluid-type($font-style: inherit, $font-name: inherit, $min-font-size: 12px, $max-font-size: 21px, $line-height: 1.5, $lower-range: 500px, $upper-range: 1200px) {
font: $font-style calc(#{$min-font-size} + #{(($max-font-size / ($max-font-size * 0 + 1)) - ($min-font-size / ($min-font-size * 0 + 1)))} * ( (100vw - #{$lower-range}) / #{(($upper-range / ($upper-range * 0 + 1)) - ($lower-range / ($lower-range * 0 + 1)))})) /#{$line-height} $font-name;
@media screen and (max-width: $lower-range) {
// font-fami
font: $font-style #{$min-font-size}/#{$line-height} $font-name;
}
@media screen and (min-width: $upper-range){
font: $font-style #{$max-font-size}/#{$line-height} $font-name;
{% for row in hubdb_table_rows(item.hubdbtable_field, orderby) %}
{% for item in row.foregin_stuff|sort(False, False, 'something') %}
{{ code }}
{% endfor %}
{% endfor %}
@NickDeckerDevs
NickDeckerDevs / scroll-to-bottom-of-div.js
Created December 7, 2018 03:38
Scroll to the bottom of the hero div after clicking on an item [STICKY header]
// <header>
// <div class="logo">......</div>
// </header>
//
// <div id="hero">
// <span class="scroll-to-bottom-of-hero">Click here to scroll to bottom of hero</span>
// </div>
// #hero is the ID of the hero element
// header is the header element that is sticky