Automatic deployment to Google Cloud Functions

In this post I’ll show you how to achieve a Heroku-like push-to-deploy capability on Google Cloud Functions. If you don’t know Google Cloud Functions (GCF), it’s a serverless architecture for running services on Google’s services. It’s equivalent to AWS Lambda. You can read about it here. Goal Pushing any code to the master branch of our Github repository should automatically trigger a deploy of our new code to GCF. »

Generate a random order-number

For one of my projects, I needed to generate a random order number that will be sent to customers in an email after they order. Lots of companies do that, it usually looks like this: Requirements Has to be all digits. Needs to be unique. We don’t want two orders to have the same order number. Has to be random - i.e. not enumerable. We don’t want the orders to be consecutive for example (5001, 5002, 5003, …) so that people can’t guess other orders numbers. »