Blog

C# – Cool Feature – String Interpolation

Have you ever wanted to concatenate multiple strings to make one string and felt like the code should be shorter? So have I. For instance you may have written something like this: Of course the above code will work fine to make the message but it would be great to […]

By Chris West, ago
Blog

How To Add Custom JavaScript To WordPress Posts

Let’s say that you want the following JavaScript to run directly in a WordPress post: To execute that you can write the following into your post: The resulting of running the above in a WordPress post is this: As you may have noticed, since I am using document.write(…) to write […]

By Chris West, ago
Blog

C# Snippet – Error Count In ASP.NET Controller

Perhaps, like me, you find yourself maintaining an ASP.NET MVC web application and you need to find the number of errors added to the ModelState. Of course, you may think that you can just use something like ModelState.Count, but this will not give you the number of errors added via […]

By Chris West, ago
Blog

JavaScript Snippet – getGitContents(…)

Have you ever wanted to get the contents of a GitHub file via JavaScript? If so I wrote the following function which gives you the ability to get the contents of a file or of a directory: Here is an example of using the above function: And here is another […]

By Chris West, ago
Blog

PL/pgSQL Snippet – get_url_params()

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 […]

By Chris West, ago
Blog

JavaScript Snippet – vueToHTML(…)

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 […]

By Chris West, ago
Blog

PostgreSQL – Query Hierarchical Data Without Recursion

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 […]

By Chris West, ago
Blog

Restore Video Volume Settings in Google Chrome

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: […]

By Chris West, ago