Hooks are a way for one piece of code to interact/modify another piece of code at specific, pre-defined spots. They make up the foundation for how plugins and themes interact with WordPress Core, but they’re also used extensively by Core itself.
Continue reading “WordPress Hooks”Animated header
Javascript Promises
My collected notes on the topic of Promises in Javascript.
A Promise
is an object representing the eventual completion or failure of an asynchronous operation.
Sorting multi-dimensional arrays in PHP
Some basic code examples.
MySQL
My personal cheatsheet/reference.
Continue reading “MySQL”PHP Notes
All keywords (e.g. if, else, while, echo, etc.), classes, functions, and user-defined functions are NOT case-sensitive, but all variable names are case-sensitive.
A variable starts with the $ sign, followed by the name of the variable
A variable name must start with a letter or the underscore character
A variable name cannot start with a number
A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ )
Variable names are case-sensitive ($age and $AGE are two different variables)
Python dir notes
Use os.listdir (or os.scandir in >= 3.5) to list items in a single directory, use os.walk (which uses os.listdir or os.scandir in >= 3.5) to list items in a directory tree.
Using os.walk for just a single directory is not as efficient as just using the function it uses internally to do that job.
Understanding the “this” keyword in Javascript
The this
keyword always refers to an object.
We can use it outside of any function in the global scope but most often it is used inside a function (otherwise known as a method, when the function is defined inside an object).
When it is used within a method, it refers to the object on which the method is being invoked.
Continue reading “Understanding the “this” keyword in Javascript”
Functions and Objects links
Just a bunch of good links specifically relating to Objects, Functions and Prototypal Inheritance in Javascript.
CSS Centering
Horizontal centering.
When the element to be centered is an inline element we use text-align
center on its parent.
When the element is a block level element we give it a width and set the left and right margins to a value of auto.
Vertical centering
The values for vertical-align
have meaning with respect to a parent inline element.