• Skip to primary navigation
  • Skip to main content
Sal Ferrarello
  • About Sal Ferrarello
  • Draft Posts
  • Speaking
  • Connect
    Twitter GitHub
You are here: Home / Archives for Programming

Programming


Warning! This is a draft, not a finalized post. See full draft disclosure.

PHP require vs include

Last updated on November 1, 2019 by Sal Ferrarello

The behaviors of “require”, “include”, “require_once”, and “include_once” in PHP are all very similar with some slight differences. Here is the table highlighting the different behaviors of these statements.

Filed Under: Dev Tips, Draft, Programming Tagged With: PHP


Warning! This is a draft, not a finalized post. See full draft disclosure.

Create WordPress Child Theme

Last updated on November 1, 2019 by Sal Ferrarello

You can quickly create a WordPress child theme by creating a new theme directory and adding two files: style.css and functions.php.

Filed Under: Draft, Programming Tagged With: WordPress, WordPress Theme


Warning! This is a draft, not a finalized post. See full draft disclosure.

PHP declare(strict_types=1);

Last updated on October 23, 2019 by Sal Ferrarello

What does declare(strict_types=1); do in PHP? PHP is a weakly typed language, which means that when a value is of the wrong type, PHP tries to cast it to the proper type. For example if you try to add an integer and a string, echo 5 + “3”; PHP will try to cast the string […]

Filed Under: Computing, Draft, Programming Tagged With: PHP


Warning! This is a draft, not a finalized post. See full draft disclosure.

phpcs display sniff name

Last updated on October 25, 2019 by Sal Ferrarello

By default phpcs does NOT display the relevant name of the sniff when a sniff fails. By adding the ‘-s’ argument, the sniff names will be displayed. See the following from ‘phpcs –help’. Alternatively, this can be added to your PHP CodeSniffer XML Ruleset.

Filed Under: Dev Tips, Draft, Programming, Solution Tagged With: PHP, PHPCS

Screenshot of Google Chrome console Video Playback Rate change failing.
Warning! This is a draft, not a finalized post. See full draft disclosure.

Speed Up Video in Iframe

Last updated on September 6, 2019 by Sal Ferrarello

My wife has to watch some videos as part of an online course. These videos do not have speed controls, however she would like to watch the video at an increased rate (e.g. 1.5x the normal speed). The problem is the video appears in an iframe (which is in itself in an iframe) so targeting the video to change the speed with JavaScript is a little tricky. Here is how I did it.

Filed Under: Dev Tips, Draft, Programming, Solution Tagged With: iframe, JavaScript


Warning! This is a draft, not a finalized post. See full draft disclosure.

setUp() must be compatible with PHPUnit\Framework\TestCase::setUp

Last updated on August 26, 2019 by Sal Ferrarello

When setting up a new site using PHPUnit 8.x and PHP 7.2, I got the error message: setUp() must be compatible with PHPUnit\Framework\TestCase::setUp Because we can now define the method as returning no value (with :void) and this is part of the method definition starting in PHPUnit 8.0.0, we need to add this in our […]

Filed Under: Dev Tips, Draft, Programming, Solution Tagged With: PHP, PHPUnit


Warning! This is a draft, not a finalized post. See full draft disclosure.

Modern Tribe Events Calendar Replace Default Event Link with Event Website

Last updated on August 23, 2019 by Sal Ferrarello

When using the WordPress plugin [The Events Calendar](https://theeventscalendar.com/) by Modern Tribe the default link in the calendar will point to the Event page. However, sometimes we want to point this link to the Event Website value (which we can set when creating the event). This is the code I use to do this.

Filed Under: Draft, Programming, Solution Tagged With: The Events Calendar, WordPress Plugin

WordPress Customizer button in Admin Bar.
Warning! This is a draft, not a finalized post. See full draft disclosure.

Getting Started with CSS and WordPress

Last updated on August 13, 2019 by Sal Ferrarello

A great place to get started with web coding is CSS. CSS tells the web browser how to display the information on the page, for example the color, size, or font to use. WordPress makes it particularly easy to add your own CSS to your website.

Filed Under: Dev Tips, Draft, Programming Tagged With: Customizer, WordPress


Warning! This is a draft, not a finalized post. See full draft disclosure.

The difference between __() and _x() in WordPress

Last updated on May 30, 2019 by Sal Ferrarello

WordPress has two similar translation functions __() and _x(). The function _x() does the same thing as the function __() except the _x() function allows you to define a context for the translation (with the $context parameter). This is helpful when you have a string that could be two different words. For example there are two words that are spelled “tear” each with a separate meaning (and separate pronunciation). By including the context you could use both of these words and have them correctly translated based on their $context value.

Filed Under: Draft, Programming Tagged With: WordPress


Warning! This is a draft, not a finalized post. See full draft disclosure.

HubSpot API call fail INVALID_DATE not midnight!

Last updated on May 21, 2019 by Sal Ferrarello

When making a HubSpot API call to update a date picker field, I’m getting a response with “response code 400”, “error INVALID_DATE”, and the message includes “not midnight!”. This is why I’m getting this error and how I fixed this call.

Filed Under: Dev Tips, Draft, Programming, Solution Tagged With: DateTime, HubSpot

  • Page 1
  • Page 2
  • Page 3
  • …
  • Page 14
  • Next Page»

Copyright © 2019 · Bootstrap4 Genesis on Genesis Framework · WordPress · Log in