Drupal: Get the node/bundle when preprocessing a paragraph

Posted by & filed under blabbing.

If you need to preprocess a specific paragraph type for it’s content or fields but you need to know the node/entity type that the request is coming from you can use the following. Make sure that you check to make sure the $node is not NULL before running methods against $node. Here we are going… Read more »

CSS selector for lang :not en/english

Posted by & filed under blabbing.

This type of CSS selector can be useful for when you have a multi-lingual site and some content or features may be different between the EN (english) site and other languages. Without having to explicitly name each language in the selector you just want to say “everything that is not EN”.

Load the fonts first for page speed

Posted by & filed under blabbing, Design, Programming, web.

To increase page speed for blocking font rendering and to reduce the font rendering time when the page loads on your site, add your fonts as a preload at the top of your page. This may seem counter intuitive to load an asset ahead of time for page speed, but it makes sense in two… Read more »

Triggering javascript on change programmatically and have it bubble

Posted by & filed under Programming, web.

A problem I ran into recently is that updating an input value is a form using javascript or jQuery is fairly easy but sometimes this programmatic update of the field does not trigger an onChange event that another piece of code is listening for. Adding a dispatchEvent on the selector can accomplish this.

Working with Hubspot forms onFormSubmit

Posted by & filed under Programming, web.

Getting values from the hubspot form in it’s onFormSubmit handler can be pretty tricky so here is a quick tip. Add the onFormSubmit closure function to the hbspt.forms.create script and then use .find() to get the value of individual form elements that you need. At that point you can use them to pass to tracking… Read more »

Finite and infinite games

Posted by & filed under blabbing.

Something I ran across recently that I liked. There are two types of games: finite games where rules are known & an end is set, & infinite game, where the rules can change and the end is unknown, & rules can change. Your outlook/beliefs will determine the game you believe you are playing.

Stop animating all your pages

Posted by & filed under blabbing, Design, web.

You know that feeling when you get to a site and there isn’t much there and then you start to scroll and POW everything comes flying into the page in all directions. Yeah. Stop doing that.

Simple JS based resize calculator

Posted by & filed under web.

I made this image resize calculator because I was always going into Photoshop to recalculate an image size and maintain the aspect ratio. https://www.fuzzyraygun.com/resize.html

Fix for svg background images in IE11

Posted by & filed under web.

Problem: Sometimes SVG images when used as background images do not show up correctly in IE11. This can sometimes show up as not covering the specified element background. The trick here is the add the height and width back into the SVG as it might have been stripped out. Take the height and width from… Read more »