Ideas Into Software

Musings on writing code

All posts by Tomas Brambora

Typescript: Omit And Projection Types

Typescript 2 introduced a number of useful mapped types such as Pick or Partial. However sometimes the predefined ones just don't cut it. Here's two new types you can use to make your life easier. Omit Pick is handy when you need to create a new type from an existing interface with only the specified keys. Which is great but

Routing Emails Through Meteor Server

Some time ago I was adding email messaging to sharewaste.com - a waste-reducing app that connects people with kitchen scraps to their composting neighbours. It turned out to be a tad bit trickier than originally expected. You see, I started with the simplest thing: a "click here to reply" link in the emails. Naturally, it turned a lot of

TypeScript Conditional Imports And Reference Elision

ES6 modules specification explicitly states import/export statements may only be used at the top level of files. Static imports like this bring about a number of benefits such as first-class support for circular dependencies between modules and (potential) support for macros but it also means you cannot conditionally import modules. Which can be a fairly big issue if you're

On delayed tasks

Scheduling tasks to be executed later is a pretty common scenario in backend development. Say you want to send a welcome followup email to a new user 24 hours after they sign up for your service. There’s a couple ways to approach this. Bad approach - using a timeout Pretty simple: User.onSignup((user) => { setTimeout(() => { sendFollowupEmailToUser(user)

6 Tips To Becoming a Better (Web) Developer

Much like football is not just about kicking the ball, programming is not just about writing code. Below I've summarized six things I've learned over the last ten years as a professional programmer that will help you become a better developer not just in terms of the code you write but all around. 1. Make. Yourself. Comfortable. I can't stress