Random projects all by Chris West.
⇩ Continue ⇩

JavaScript Snippet – Select Text In Any Element Jul 15, 2017
at 6:11PM

The following function takes one arguments, an element, and selects the text therein: Happpy coding! 😎

PHP – Simple GitHub Login (OAuth) Jul 7, 2017
at 11:46AM

If your codebase is in PHP and you would like user’s to be able to login to your site using GitHub (single sign-on) you can use the following as a good starting point: Next you will need to setup an OAuth application within GitHub by doing the following: Login to Go to your settings …

Install Watchtower Library On Mac (with Multiple Languages) Jul 3, 2017
at 10:47PM

If you have a Mac and want to install the Watchtower Library on it chances are that you will be able to do it. Here is how: Download a “stable version” of WineBottler from the official site here. Open the WineBottler DMG file that you downloaded by double-clicking on it. Once open, drag-and-drop both Wine …

Sing to Jehovah & Sing Out Joyfully Comparison Jul 2, 2017
at 11:01PM

Recently I had the desire to see a comparison of the old Sing to Jehovah songbook compared to the new Sing Out Joyfully songbook. Here is the result: Español (Cantemos a Jehová / Cantemos con Gozo a Jehová) Para todos que quieren ver una comparación del cancionero “Cantemos a Jehová” con el nuevo “Cantemos con …

ES6 – Convert To Integer Jun 27, 2017
at 8:31AM

There are various ways to convert a string or a floating point number to an integer in JavaScript, but not all of them may suit your needs. In this post we will examine four different ways and then we will see which is the best in all cases. Solution #1: ~~x If we are dealing …

CSS – Local File System Paths On Windows Jun 16, 2017
at 2:21PM

When working with Windows you probably have noticed that local file paths use the backslash as the path separator. Although this is the case, even on Windows, in CSS you can use the forward-slash as a path separator to reference an image. If you want to use the forward-slash though, you must escape it with …

JavaScript – Create Gradient Image Using Canvas Jun 13, 2017
at 1:31AM

The <canvas> can be quite useful, especially if you want to modify how images look on your site. For example, if you want to make an image appear as a gradient starting at the top with an alpha of 0 and then linearly fading to the image’s full alpha value you can use JavaScript along …

JavaScript – Use Canvas To Watermark Images Jun 11, 2017
at 11:26AM

Did you know that you can add a watermark to all of your images that are on the same domain as your site just using JavaScript? Thanks to the <canvas> we can modify images and present in various ways as if they were originally available that way all via JavaScript. The following function is a …

JavaScript Snippet – Get Video Frame As An Image May 3, 2017
at 4:03PM

Lately I have dedicated a little more time to developing an electron app which saves a frame of every video it encounters as PNG images: Believe it or not the code to turn a frame of a video into an image element is not terribly complicated. Below is a simple function that can be used …

JavaScript Snippet – toggleFullscreen() Apr 26, 2017
at 12:56AM

Making your web app toggle back and forth between full screen mode is a simple enough task as long as you do some feature testing. You can also use this handy function which will step through the 4 different feature tests: This code is based off of documentation found here on MDN. I personally am …