Tim Perry

Tech lead and open-source champion at Softwire. Creator of Build Focus. Keen open-source contributor, and maintainer of Loglevel and Server Components.

Opening Open Source with DevOps at DevDay
Promises Are So Passé at Frontend Conference

How can you use client-side libraries like Leaflet, on the server?

Get easy confidence on exactly what you’re committing.

You’ve written an application deployed using Dokku, and you’ve got it all up and running and great. You’ve heard a lot about why HTTPS is…

Why do we need better maps, and how does server-rendering help?

Opening Open Source with DevOps at DevOps BCN

On shadow dom: for now server components isn’t worrying about giving you free shadow dom. You’re right, you certainly don’t get that…

The developer experience of web components, with the power and simplicity of server-side development.

Opening Open-Source with DevOps at DevOpsPro

DevOps has made great strides across the software world, but not yet in open-source. Open-source has never been the most accessible part of software development to jump into, but we can help fix that.

In this talk we’ll look at real-world examples of how DevOps tools and techniques have been used to simplify setup, development and deployment in a selection of open-source projects, and learn how you too can help make open-source more open, for everybody.

I bought a Macbook recently, and I’ve been doing some of the courses from Wash U’s Machine Learning Specialization on Coursera. They’re…

Microservice Pipeline Architecture at ITAKE Unconf
New NPM fun: many projects depend on 'fs' (wrongly, it's built in) so dropping this junk package breaks their builds https://twitter.com/npmstatus/status/768184714783956997
I've just dropped @Dropbox for @Seafile. DropBox breaks with Git/node_modules/build output, but Seafile has ignore globs! Fixes all of that.
Wow, @Raganwald sure gives great talks on optimism & feedback: https://github.com/raganwald/presentations/blob/master/optimism.md
Spent this evening doing some surprisingly fun data analysis in @Kaggle on gender-ambiguity of baby names in the US: https://www.kaggle.com/pimterry/d/kaggle/us-baby-names/changes-in-gender-ambiguity-in-us-baby-names
Yes! Exactly, it's too dangerous by half.
DDoSCoin: https://www.usenix.org/system/files/conference/woot16/woot16-paper-wustrow.pdf. Bitcoin, but proof of work comes from contribution to DDoS attacks. Part brilliant, part terrifying.
Awesome looking low poly city models: https://www.kickstarter.com/projects/1005623841/low-poly-city-builder Maybe @BuildFocus needs move to full 3D...
Sad look at the security of bluetooth door locks. TLDR: there isn't any. Plaintext keys, effortless replays, & more. https://twitter.com/x0rz/status/762930595282423808
Building a Server-Rendered Map Component (Part 2: Using client-side libraries): http://ift.tt/2aMtfDo
Who do I know who loves #productdesign, and building products people love to use? Anybody want to come talk at @SoftwireUK? (#London)

Here your TypeScript has compiled happily, to code that will work in a requireJS environment (technically, an AMD environment). That means it generates output that assumes that define/require etc all already exist.

The overall answer is that you need to include RequireJS before you depend on your compiled code.

Notably the error suggests you've made a separate mistake though: you're depending directly on the RequireJS module scripts (i.e. you have a <script src="my-compiled-code.js"></script> tag in your HTML). That's not how require modules work. Instead, once you've made RequireJS available, you should have a single top-level startup script (either inline in your HTML or as a separate file) that configures RequireJS and then require()'s the top-level files of your application to start everything off. You can load this file either by hand, or with RequireJS's "data-main" attribute.

For example, a minimal HTML looks something like:

<!DOCTYPE html>
<html>
    <head>
        <script data-main="scripts/main" src="scripts/require.js"></script>
    </head>
    <body>
    </body>
</html>

This loads RequireJS from 'scripts/require.js' and then tells it to load the script at 'scripts/main.js' to start off the loading process (you'll probably want to update both paths - note that data-main doesn't need a .js extension).

The main script should then be something very simple like:

// Set up any config you need (you might not need this)
requirejs.config({
  basePath: "/scripts"
});

// Tell RequireJS to load your main module (and its dependencies)
require("mainmodule");

Generally, it's not TypeScript problems you're fighting here, it's RequireJS. I'd try spending a bit more time playing with just Require (maybe in pure JavaScript, so it's clearer) and looking at working examples for that, so you can get that bit working first, then add in the rest.

Introducing Git Confirm: http://ift.tt/2azjBCt
Awesome to see web animation API support starting to improve (still *very* early days tho: http://caniuse.com/#feat=web-animation) https://twitter.com/vlh/status/761551437847490561
And bam: Git Confirm is straight on the front of Hacker News. And bam: PR arrives to fix my typos. Ah, open source. https://twitter.com/HNTweets/status/760877899712823296

For a more general and thorough solution to this, take a look at Git Confirm:

Asciinema Git Confirm demo

Move add flag in suggestion to correct position
New project: Git-Confirm https://github.com/pimterry/git-confirm Git hook to catch accidental placeholder/temp additions (TODO / @Ignore) before commit.
How to intercept HTTPS traffic from #PokemonGO, even with certificate pinning: https://eaton-works.com/2016/07/31/reverse-engineering-and-removing-pokemon-gos-certificate-pinning/
The video from my talk at @ITAKEUnconf is up! Take a look, and learn about microservice architectures in practice: https://www.youtube.com/watch?v=IfRx5LZe1vg
This looks fun: https://www.pubstorm.com/ Free static content hosting, inc CDN, SSL + custom domains, with tiny Node tool to setup & publish.