Category: Development

  • JavaScript Copy To Clipboard

    This is such a little handy function copy using Javascript copy to clipboard that allows you to create a button that will copy a block of content into the user’s clipboard. The solution is to use the built-in execCommand function.
    (more…)

  • C# Convert date from UTC to EST

    Every now and then I need to convert a date from Coordinated Universal Time (UTC) to Eastern Standard Time (EST).  I always found myself trying to remember: Where did I use this last?.  To avoid asking myself, I have now immortalized it on my blog. The solution leverages TimeZoneInfo.ConvertTimeFromUtc. The following will use C# convert utc to timezone and C# convert datetime to utc. This is of course not limited to EST and can be used to c# datetime utc+8 (e.g. utc to rst).

    (more…)

  • MVVM Pattern – Model View View Model

    Let’s learn all about what MVVM is through practical examples.
    (more…)

  • Solving No Access-Control-Allow-Origin with Node js and Express

    If you are receiving an error similar to XMLHttpRequest cannot load localhost:3000. No Access-Control-Allow-Origin header is present on the requested resource. Origin localhost:8888 is therefore not allowed access. This typically implies that you need to enable CORS on your Node js server that is running Express as the web server. Example code below.

    (more…)

  • Add Function to Prototype with Javascript

    In some of my more recent posts about How to compare arrays in Javascript and Format Numbers as Currency with Javascript I have been enjoying adding them as extension methods to simplify their usage.

    Honestly, I’ve always been afraid to do it because it seems “hard”. Now that I’ve done it once though, it is now becoming second nature. I really can’t believe I haven’t done this before because I absolutely love adding string extensions when I developer with C#.

    Let’s take a look at some code to add a function with prototype using Javascript. In this first example I will add it to the Javascript Array Prototype:

    (more…)