Skip to content

Instantly share code, notes, and snippets.

View NickDeckerDevs's full-sized avatar

nicholas decker NickDeckerDevs

View GitHub Profile
@NickDeckerDevs
NickDeckerDevs / remove_css.js
Created July 15, 2017 14:54
Remove a stylesheet using scripting after it has been loaded
var stylesheet_url_to_remove = 'https://static.hsstatic.net/content_shared_assets/static-1.4040/css/public_common.css';
$('head').find('link').each(function() {
var current_stylesheet = $(this).attr('href');
if(current_stylesheet == stylesheet_url_to_remove) $(this).remove()
});
{% set queryone = hubdb_table_rows(111111, "&orderBy=last_name") %}
{% set querytwo = hubdb_table_rows(222222, "&orderBy=sandwich") %}
<div class="content">
{% set counter = 0 %}
{% for row in queryone %}
<div class="col-md-4 resource-container">
<img class="reponsive" src="{{ row.image.url }}">
</div>
{% if loop.index == 10 %}
<div class="col-md-4 cta-container">
@NickDeckerDevs
NickDeckerDevs / readtime.hubspot.html
Last active February 15, 2018 05:35
Hubspot hubl read time for blogs / content
{# RENDER READ TIME #}
{% macro render_read_time(body) %}
{% set str = body|lower %}
{% set img_count = str|split('<img')|length %}
{% set img_minutes = ((img_count * 12) / 60)|round(0, 'common') %}
{% set read_time = (str|striptags|wordcount / 275)|round(0, 'common') + img_minutes %}
{{ read_time|string|trim ~ ' ' ~ render_read_time_suffix()|trim }}
{% endmacro %}
{# And here's the meta info for the <head> of the custom template... #}
@NickDeckerDevs
NickDeckerDevs / check_login.js
Last active August 8, 2017 21:53
Check gliffy login status
var base_url = 'https://www.gliffy.com';
$.ajax({
url: base_url + "/go/api/user.json",
dataType: 'json',
}).done(function(data) {
console.log('done')
console.log(data);
}).fail(function(jqXHR) {
console.log('fail')
console.log(jqXHR)
@NickDeckerDevs
NickDeckerDevs / stickyhead.hubspot.js
Created August 9, 2017 19:18
Sticky Header HubDB
/* Append column headers to top*/
$('.editor-wrapper').append('<div class="fixed-header" style="overflow: visible; min-height: 60px;">');
$('.editor-header-cell').css('position','absolute').css('top','0px').css('z-index','999').clone().appendTo('.fixed-header');
/* Tracks horizontal scrolling */
$('.ReactVirtualized__Grid').on('scroll', function(){
$('.fixed-header').offset({ left: $('.ReactVirtualized__Grid__innerScrollContainer').offset().left });
});
@NickDeckerDevs
NickDeckerDevs / fix_case.js
Created August 25, 2017 14:07
bad bad bad bad idea to do this
/*
* Calls fix if user input is all lower case. This prevents changes from
* happening if the user's name has different case changes like leFlour
*/
function check_name(input) {
if(input == input.toLowerCase()) {
return fix_name(input);
@NickDeckerDevs
NickDeckerDevs / flex.scss
Created September 22, 2017 21:11
flex box shit
.flex-wrapper {
display: -ms-flexbox;
display: flex;
display: -webkit-flexbox;
display: -webkit-flex;
-ms-flex-pack: center;
justify-content: center;
flex-direction: row;
// padding: 0;
@media#{$phone}{
@NickDeckerDevs
NickDeckerDevs / add_p_tags_to_richtext_widget.html
Last active November 10, 2017 15:50
LOL not working : If a widget doesn't have p tags, add them (hubspot)
{% !if widget.widget_name is string_containing '<p>' %}<p>{% endif %}{{ widget.widget_name }}{% !if widget.widget_name is string_containing '</p>' %}</p>{% endif %}
@NickDeckerDevs
NickDeckerDevs / stearns-mobile-transport.js
Last active October 17, 2017 13:03
Moves a custom sidebar through the content and back on breakpoint.
var $sidebar_container = $('.custom-mobile-left-sidebar');
var has_three_column = $('.three-column-equal').length > 0 ? true : false;
var $content_container = $('h1').parent();
var sidebar_is_swapped = false;
function move_sidebar_if_mobile() {
var wwidth = $(window).width();
if(wwidth <= 767 && sidebar_is_swapped == false) {
@NickDeckerDevs
NickDeckerDevs / fancy_slider.js
Created December 11, 2017 16:32
custom slider for gliffy
$.fn.extend({
fancy_slider: function() {
var slider = {
el: {
slider: $(this).find('.slider-wrapper'),
holder: $(this).find('.slider-container'),
imgSlide: $(this).find('.slide'),
slider_nav: $(this).find('.slider-nav'),
all_nav_buttons: $(this).find('.slider-nav > a'),
title_navigation: $(this).find('.product-tab')