As I explained in my HelloFresh review here, we have been trying out at home meal kits because of the shortages of basics in the grocery stores here in Australia such as; mince, flour, eggs and so on.
After trying HelloFresh, we decided to try out Dinnerly which markets itself as, “Australia’s most affordable home dinner kit” it’s actually owned by Marley Spoon, just a cheaper version for those who cannot afford Marley Spoon which is one of the more expensive options.
Recently whilst working on some blockchain specific code, I needed to write a random number generator to simulate generating a range of numbers, except it needed to be predictable. The same input values produce the same output when provided.
In my case, I used values from immutable blockchain data such as the blockchain number, reference block number and transaction ID. I then allow the user to provide a client seed and generate a unique server seed on each roll as well.
Globally, many of us are all in the same unfortunate and unprecedented situation because of the Novel Coronavirus COVID-19. I am fortunate to both work in an industry where I still have a job and for a company mostly unaffected by COVID-19.
Sadly, for many, this is not the case as people find themselves out of work through no fault of their own. For others, they find themselves working remotely; for many, it’s their first time.
This COVID-19/Novel Coronavirus has really changed the world and how we live. Even the basic things we take for granted like being able to go to the shop and buy meat, bread, rice and toilet paper have become difficult tasks.
We have a family of four. Two adults and two children, my son is four years old and my daughter is fourteen months old. Out of frustration of not being able to find basics in the stores like; flour, eggs, rice and mince, we decided to explore home meal kits.
If you have been watching the news of late and let’s be honest, who hasn’t given we are a part of an unprecedented global pandemic? Then you would have heard of the announcement of a contact tracing application you install on your phone which notifies you and others if you’ve been in contact with anyone who tests positive for COVID-19.
On the surface, every day Australians will hear the government say, “If everyone installs this, we can ease restrictions faster and flatten the curve by being able to control the spread” – but for those in tech like myself who are critical of the government’s ability to produce an app that won’t be a privacy nightmare, things are a little more convoluted.
Whilst doing some work in a library I maintain, I needed to add in the ability to calculate the hash of an included file for an integrity check feature I was adding in. The resulting solution is simple and not boast-worthy, but given others might encounter a situation where they need a hash of a file, this might help.
We use the fs module to open up the file we want to calculate the hash for, use the createHash method on the crypto package to then pass in our file buffer from the readFileSync method, and that’s it.
For years the people have been asking for tab groups in Chrome. While extensions do exist, they’re somewhat fickle. Now, tab groups are natively supported in Google Chrome itself. While the feature is rolling out in Google Chrome 81, if you’re like me, you’re running Chrome 81 and the feature isn’t on for you yet.
If you right-click on a tab and can’t see the new tab group options, you need to enable it. To visit the flags screen, open a new tab and visit: chrome://flags/ – in the search input, enter groups.
Recently, whilst working on an open-source project I work on we found ourselves running out of space on the server. The weird thing is the projects on the server themselves were barely 100mb in total file size, but we had run out nonetheless.
After a little investigation to see what is using up the majority of space, the search led to the /usr/src folder which contains source header files for Ubuntu’s APT package manager. A trove of files in here weighing around 100mb seemed to add up to 4 gigabytes of used space.
I love using Jest to unit test my Aurelia applications. Sadly, one of the most popular options for mocking event listeners and simulating events called Enzyme is targeted at React applications and to my knowledge, does not work with Aurelia or any other framework like Angular.
If you are wanting to test events registered using addEventListener there is an easy way to mock them.
describe('My Test', () => { let sut; let events = {}; beforeEach(() => { sut = new Dependency(); // Empty our events before each test case events = {}; // Define the addEventListener method with a Jest mock function document.addEventListener = jest.fn((event, callback) => { events[event] = callback; }); document.removeEventListener = jest.fn((event, callback) => { delete events[event]; }); }); test('Test Keypress fires callback', () => { // Watch the function that gets called when our event fires jest.spyOn(sut, 'pressed'); // A method inside of our dependency that sets up event listeners sut.setupEvents(); // Fire the keypress event events.keypress({ key: 'Enter' }); // We fired an event, so this should have been called expect(sut.pressed).toHaveBeenCalled(); }); }); Inside of the beforeEach we do a few bootstrapping things before we run our tests. The sut variable is actually the thing we are testing. In this instance, Dependency is a class with some methods inside of it.
Perhaps one of the most confusing aspects of building a publicly visible Firebase application hosted on GitHub is when you add in your SDK configuration details and commit them you’ll get warnings from a bot called Git Guardian and an email from Google themselves.
I am not sure if everyone gets these, but I do for every publicly visible Firebase application I have on GitHub.
The code in question that triggered these latest warnings for me looked like this: