General


  • (JS) Calculate price excluding VAT

    Sometimes you need to calculate the price of a product excluding VAT, and the only details you have is the amount including vat and the vat percent. This might be a bit tricky in some applications when there are mixed VAT percentages. For example, you payed 1000 space credits and in that sum there is…

  • Laravel with SSL through Cloudflare on Heroku.

    Laravel with SSL through Cloudflare on Heroku.

    I deployed a Laravel app on Heroku, using Cloudflare for SSL. As a quick note, here’s how I did it. NOTE: if you’re using Laravel 5.4 or higher it’s forceScheme instead of forceSchema Also, you need to set your Laravel environment variable APP_ENV to production (or at least something else than local). Do this in…

  • YouTube Tutorials

    My all time favorite tutorial maker Derek Banas has an extensive catalogue of programming tutorials on his Youtube channel. I’ve used those a lot, especially in my studies. His series on design patterns are golden! I really like the tempo in them. Very hands-on and very organised. He has a bunch of videos that covers…

  • Debug link shared on facebook

    Sometimes when you share a link to you site on Facebook it uses old thumbnails for the link image. There’s a ton of useful info about your site here: https://developers.facebook.com/tools/debug

  • Generate dummy data

    Here’s a great tool for generating dummy data for your database etc. www.generatedata.com

  • Convert seconds to days, hours, minutes and seconds

    Converting seconds into days, hours, minutes and seconds int days = secondsTotal / 60 / 60 / 24; int hours = (secondsTotal / 60 / 60) % 24; int minutes = (secondsTotal / 60) % 60; int seconds = secondsTotal % 60;

  • Simple function to see if a number is Even or Odd.

    Sometimes you need to check if a number is even or odd. A simple way to do this is using the modulus operator (the %-sign). It will calculate and return the remainder when dividing a value with another value. So how do you use that to find out if a number is even or odd?…

  • A couple of principles when learning how to code.

    Principle 1. Always have a clear image of what you want to do BEFORE you start writing your code. Then break it down in logical instructions – making an algorithm.  An algorithm is a step by step instruction on how to solve a specific problem. You might think of it as a recipe. If you…