Blog

JavaScript Snippet – domReady() Function

Sometimes you may want to know if the DOM is ready to be manipulated. Most of the time you want to run some code only after the DOM is ready to be modified. For that reason for years we used jQuery’s ready() function or some equivalent. Now many have moved […]

By Chris West, ago
Blog

Hack – Get A User’s GitHub Avatar

Have you ever needed to get any user’s GitHub avatar just based on their username? If you have then you are in luck because the process is quite simple. All you need to do is place the username in the following URL: https://github.com/<REPLACE_WITH_USERNAME>.png Simple Example For instance my username is […]

By Chris West, ago
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