Recently I began updating TidyFork to be written in Aurelia 2. As such, I took the opportunity to change how the repositories were loaded in the UI. There are numerous Octokit libraries provided by GitHub which let you make requests to the GitHub API.
Using the request.js package, I make calls to the GitHub API. I also use the Parse Link Header package to parse the pagination headers that GitHub returns on its API responses.
Working with dates in 2020 are still a mess. Presumably, they’ll also be a mess to work within 2021, 2022 and for a good while after that. Many (myself included) reach for a date library to fill the gaps.
For years Moment.js reigned supreme and for good reason, it can do everything with dates, including working with different time zones. Unfortunately, Moment can also result in bundle bloat.
And then came along date-fns. It could do almost everything Moment did and was good enough for 95% of all date and time related use cases. However, depending on the task, you can still use native vanilla Javascript to work with dates.
Recently, while I was building an application on Firebase and implementing Firebase Storage, I realised that I have to always consult old Firebase projects I have built or scour the web for blogs and documentation that explain not only how to do uploads to Firebase Storage but also write rules to protect them.
My use-case is as follows:
Users can create listings A listing can have one or more images An image is uploaded to Firebase Storage in the form of listing-images/userId/filename.extension I only want to allow users to write to this folder if they are that user currently logged in. This folder becomes a bucket for all of the users listing images. Uploading Files const storage = firebase.storage().ref(\`listing-images/${this.auth.currentUser.uid}/${image.name}\`); const upload = storage.put(image); upload.on('state\_changed', // Uploading... (snapshot) => { this.frontImageUploading = true; }, // Error () => { this.frontImageUploading = false; }, // Complete () => { this.frontImageUploading = false; } ); Uploading files with Firebase’ Javascript SDK could not be any easier. You create a reference to where you want to store a file and then you call the put method providing a file to upload.
I do quite a lot of work with Firebase and when you are working with authentication claims, they will be returned as an object containing your simple values (usually booleans).
Thankfully, since ES2015 landed, each Javascript release has introduced a new and easier way to work with objects and convert them into arrays. You don’t need any libraries like Lodash, this is all native and well-supported vanilla Javascript.
To convert an object of properties and values, you can use Object.entries however, it will return an array of arrays, which isn’t terrible but might confuse Javascript novices as to how you would even work with these.
As much as I love Firebase, especially it’s easy to implement authentication, for some things Firebase can be a bit confusing when you go to implement them.
For Firebase Authentication, sadly, you cannot store any additional information and easily query it for authenticated users. You can leverage custom claims to add little pieces of meta to a user (like roles), but for things such as profile data, you can’t.
Fortunately, there is a solution you can easily implement using Firebase Functions and triggers.
Whenever I am working I listen to a wide-variety of different genres of music. My dominant genre is metal and other derivatives of heavy music which I enjoy. Then I also listen to blues as well as rap/hip-hop and instrumental music too.
One of my more recent genre additions is Lo-fi. Admittedly, I am late to the party on the Lo-fi music genre, but it has been a game-changer for me and how I work. It’s not a genre of music I would have listened to a couple of years ago.
In these uncertain pandemic times, seeing mask shortages and other shortages has our family thinking about self-sustainability. What can we rely on when supply chains fail? Not just food, but things like clothing and the hot topic right now: masks.
A decent mask requires three layers of protection and material. You have the outer layer, the middle layer and then the inner layer. The ear loops are the final step, but they don’t offer protection.
I think many would agree that 2020 has been a terrible year on multiple fronts. One of the biggest dampers on 2020 was COVID-19, which has changed how we live, interact, work and go about our daily lives.
Perhaps the biggest positive and upside to COVID-19 is the remote work revolution that was forced upon everyone. For some of us, we were ready for it and either already remote working or wanting too. Companies had a choice, allow their employees to work remotely or not work at all.
COVID-19 has changed how we live and how we work, it has also changed how we parent. As parents have been thrown into the unknown as schools are closed or parents take their kids out over fears of bringing the virus home.
My wife and I have two children; a five-year-old boy and a one-and-a-half-year-old girl. Keeping our active son entertained during moments of quarantine has been very challenging, to put it mildly.
A few days ago I came across an article by Jared Palmer titled GitHub isn’t fun anymore besides the somewhat clickbait-y title he talks about the changes that GitHub has made to the trending section and how GitHub doesn’t feel fun any more.
Sure, the trending page is a cool little gimmick section where you can see popular repositories (or used to be able too), but GitHub was never about fun or non-code features. GitHub is a tool.