Category: Software Development
-
Using <style /> blocks in React
Every once in a while you are faced with a scenario where the best course of action is to slap a <style /> block in the middle of your code. For us, it was that time we wanted to set an arbitrary width (selected by the user) on a component,…
-
URL routing in PHP
The other day I was checking out what folks are querying to get to my site. Of course a ton of people get here looking for VPS comparison, but what surprised me was the volume of queries for “PHP routing”. Back in 2015 I had posted a basic page rounding…
-
PHPUnit with multiple versions of PHP and HHVM on Travis CI
Recently I was updating my PHP Lorem Ipsum library in an attempt to get it testing on HHVM on Travis CI alongside the other versions of PHP I was testing against. Incidentally, the last time I had worked on the project, I had to work out some kinks with older…
-
Days until Christmas in JavaScript
Time again for one of my holiday cop out posts 🙂 Here’s a couple of ways to calculate the number of days until Christmas: Vanilla JavaScript Math.floor((+new Date(‘2018-12-25’) – +new Date()) / 86400000) Using momentjs moment(‘2018-12-25’).diff(moment(), ‘days’) Merry Christmas!
-
Adding comments to JSON
From time to time I’ve wanted to be able to comment out lines in a JSON file. This typically comes up when I’m making a butt load of changes to package.json and I want to keep a visual history as I’m tweaking things. Just last week, it came up with…
-
Configuring Jest to show code coverage for all of your files
Jest is a great tool. It’s fast, actively maintained and has been working well for us with both our front-end and back-end systems. Simply put, Jest helps us make CrowdSync better and more stable. Out of the box though, code coverage is only shown for the files that you’ve written…
-
Setting defaults for all your SuperAgent requests
SuperAgent is an HTTP request library for both Node.js and client-side JavaScript. It’s our current choice here at CrowdSync for making requests because it’s lightweight and easy to use. Unfortunately, out of the box, it doesn’t support setting defaults on all of your requests. The simplest approach would be to…
-
Simple cache busting with Webpack
Here at CrowdSync, we’re huge fans of CloudFlare. As customers, we are leveraging the power of CloudFlare’s caching mechanisms. Part of our deployment process to production involving flushing the cache via the CloudFlare API. Problem there is that only solves half of the caching dilemma. Even with our CloudFlare cache…
-
Stop over configuring Vim
Over the year, I’ve waxed and waned with the size of my .vimrc. In the early days, it was trim but so was my knowledge of Vim. Once I learned how to disable my arrow keys, I started to configure more and more. It wasn’t until I fully understood the…
-
React Draft Wysiwyg with MongoDB
We love open source software here at CrowdSync. Sometimes though, we run into issues with the software we’ve deemed as the “right” package for us. A recent incident has been with React Draft Wysiwyg which we decided to use as part of our action to compose and send emails to…