Random projects all by Chris West.
⇩ Continue ⇩

PL/pgSQL Snippet – get_url_params() May 20, 2019
at 9:26PM

One thing that you may need to use from time to time in Postgres is a function to be able to extract the value of a URL parameter from URLs stored in your DB. I wanted to be able to do this too so I wrote the following function: If […]

JavaScript Snippet – vueToHTML(…) Apr 25, 2019
at 1:29PM

Recently I have been writing plugins for Grafana and had a desire to make a panel that would give the user the ability to use the data from the query within HTML with AngularJS syntax. I have not come up with a good solution for using AngularJS to easily parse […]

PostgreSQL – Recursively Query Hierarchical Data Oct 29, 2018
at 12:00AM

I recently wrote a post about how to query hierarchical data without recursion in PostgreSQL. Now it is time to talk about how to do it with recursion. 😎 CTEs (Common Table Expressions), AKA WITH clauses, provide us the ability to not only use a query as if it were […]

PostgreSQL – Query Hierarchical Data Without Recursion Oct 27, 2018
at 7:07PM

Hierarchical data stored in a relational database such as PostgreSQL can be tricky to work with. An organization is an example of a hierarchical structure. For example, let’s say that we need to represent employees: Davy Crocket Cindy Cruz George Jefferson Blinky Bill Gustavo Frederickson Joan Smith Debora Ferreiro Harry […]

Restore Video Volume Settings in Google Chrome Sep 24, 2018
at 7:08PM

If you are annoyed by the fact that you can no longer control the volume of native videos in Google Chrome you are not alone. Originally Chrome allowed you to control the volume of videos: Now Chrome’s new video element design only allows you to mute and unmute the videos: […]

Ace Editor Vue Component Aug 4, 2018
at 4:33PM

Making certain JavaScript UI solutions work with Vue can be a bit of a hassle at times especially if you are new to Vue. Ace editor, for example, is a great solution for developer that want to add a syntax highlighting textbox to their site but right out of the […]

JavaScript Example – YourJS.toBase() Aug 3, 2018
at 6:07PM

Recently I added toBase() to YourJS. The purpose of this function is to make a straight-forward way to convert numbers to a base (from 2 to 36). Of course you can easily use native JavaScript by using Number.prototype.toString(), but the beauty of this function is that it also lets us […]

PL/pgSQL Example – Function That Returns A Table Jul 24, 2018
at 12:39AM

One thing I started doing last week was writing PL/pgSQL functions for each of my JasperReports. Each function essentially just runs and returns the rows of a query. One question that I had for a long time was how can I return these results from a function without looping through […]

JavaScript Snippet – An Inclusive Range of Numbers – span() Jul 1, 2018
at 2:26PM

One of the things I understand but dont really like about the range(), which is available in utility libraries such as lodash and YourJS, is that it produces an array of numbers ranging from the starting number to the ending number but not including the ending number. Let’s say for […]

JavaScript RegExp – Match Any Character May 26, 2018
at 11:47PM

If you have used regular expressions in JavaScript before you probably know that you can match any non-line-terminating character with just the dot (/./). Of course, you may also want to match absolutely any character in which case you can use any of the following: Most Common: /[\S\s]/ This is […]