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:
Today, I came across something which quite frankly shocked me. The AFP Tweeted out the following Tweet.
On the surface, this might seem like a harmless attempt to tell people about efforts to notify and help those affected by the bushfire, but this singular Tweet truly masks a horrifying truth of an allegedly impartial agency that investigates serious crimes Tweeting about a matter, not in their interests whatsoever.
I love a good conspiracy theory. Some of my favourite conspiracy theories include the Royal Family being shape-shifting lizards, part of some global reptilian elite controlling the world or Alex Jones’ famous rant where he claims the government is putting chemicals into the water turning frogs gay.
The late-2019 Australian bushfires which have burned into 2020 have attracted some crazy individuals claiming all kinds of crazy things. People have lost their lives, thousands of homes destroyed, towns completely wiped, millions of hectares burned, over 1 billion animals estimated to have been killed.
I have the weirdest and sometimes most profound thoughts about the most useless stuff. I actually asked myself this question whilst in the shower this morning: is there going to be a USB-D? Do we need a successor to USB-C or is it good enough for the time being?
When these types of questions pop into my head, I have to Google them. I actually stepped out of the shower and before reaching for a towel, I grabbed my phone and had to find out. With the water dripping onto my phone screen and floor, I set out to find the answer.
Every so often thought-pieces will go around proclaiming that you are writing code the wrong way and that you should be writing your code this way instead.
One such opinion I have seen (and will not link because this isn’t a takedown) is recommending the use of Ternary Operators in Javascript over if statements.
While ternaries can make your code look cleaner in some cases by replacing multi-line if statements with one-liners, there are instances where they fall apart quite quickly. Ternary operators exist in all programming languages and the problems they can introduce into a codebase are universal.
Recently, the BBC published an article titled Why we’ve never fallen in love with virtual reality in which they discuss virtual realities lack of mainstream consumer adoption.
The article then goes on to talk about one VR segment that is thriving: group entertainment. Specifically, virtual reality arcades, theme parks leveraging virtual reality in rides and offering an affordable means of immersing yourself without getting into debt.
Truly immersive virtual reality experiences in 2020 are amazing. In countries like Tokyo, they have numerous public places where VR is employed for fun experiences. Disneyland has been showcasing the power of virtual reality for some time now.
When it comes to Firebase for newcomers, the first point of confusion in what is quite a simple platform is what should you choose for your database: Firestore or Realtime Database?
As someone who has been using Firebase for quite a few years, there was a time when Firestore never even existed. Initially, it used to just be Realtime Database and that was that. A couple of years ago, Firebase introduced the Firestore database which is the next evolution of databases on Firebase.
All signs are pointing to yes. System of A Down frontman Serj posted an image of himself in the studio working on what appears to be music for a System of A Down.
Many might be quick to say this could just be Serj working on more solo material, the hashtags tell a different story at the end, using the band’s name as a hashtag.
For years there has been rumour and speculation a new album is happening. Then various members speaking out about the band’s inability to get on the same page musically, could they have found a way to work past the problems they were happening?