Skip to content

Instantly share code, notes, and snippets.

Tom Dale tomdale

Block or report user

Report or block tomdale

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tomdale
tomdale / 1-say-hello.ts
Last active Apr 11, 2017
TypeScript, JavaScript
View 1-say-hello.ts
class Person {
/** The person's given name. */
name: string;
constructor(name: string) {
this.name = name;
}
async sayHello() {
console.log(`Hello, ${this.name}!`);
View gist:f572f3f94cdbe808eb0d9abfb64880e9
v6.9.2
4.0.5
glimmer-perf-app@0.0.0 /Users/tomdale/Code/glimmer-perf-app
├─┬ @glimmer/application-pipeline@0.5.2
│ ├─┬ @glimmer/compiler@0.23.0-alpha.11
│ │ ├── @glimmer/interfaces@0.23.0-alpha.11
│ │ ├── @glimmer/syntax@0.23.0-alpha.11
│ │ ├── @glimmer/wire-format@0.23.0-alpha.11
│ │ └── simple-html-tokenizer@0.3.0
│ ├── @glimmer/di@0.2.0
View parse-cost-table
┌───────────────────────────────┬────────┐
│ Function │ Time │
├───────────────────────────────┼────────┤
│ dist/app.js │ 42.731 │
├───────────────────────────────┼────────┤
│ WeakMap │ 0.213 │
├───────────────────────────────┼────────┤
│ populateBuiltins │ 0.19 │
├───────────────────────────────┼────────┤
│ populateBuiltins$1 │ 0.171 │
@tomdale
tomdale / rfc.md
Created Sep 21, 2016
WIP Targets RFC
View rfc.md

Targets RFC

  • Start Date: (fill me in with today's date, YYYY-MM-DD)
  • RFC PR: (leave this empty)
  • Ember Issue: (leave this empty)

Summary

Gives Ember developers and addon authors the ability to build an Ember app for targets in addition to the browser.

View FastBoot Naming Questions.md

FastBoot Naming Questions

Your input is needed!

Error Handling

Right now, if an app errors out while fufilling a request, the FastBoot server returns a 500 HTTP status code and an error message. This is probably the correct behavior for using FastBoot for pre-rendering content.

However, if you're serving FastBoot pages to the end user, this is problematic. If you happen to have a route that crashes on certain circumstances, but only on Node—for example, maybe it inadvertently accesses localStorage—you'd rather serve the app to the user because

@tomdale
tomdale / deploy.js
Created Dec 22, 2015
Script for deploying zip of FastBoot build to S3
View deploy.js
#!/usr/bin/env node
var AWS = require('aws-sdk');
var RSVP = require('rsvp');
var exec = RSVP.denodeify(require('child_process').exec);
var fs = require('fs-promise');
var chalk = require('chalk');
var crypto = require('crypto');
View gist:239676ad88289c56b74e

WIP, I had to run in the middle of writing this and will flesh it out in more detail later

Managing Node.js Dependencies in FastBoot Apps

By default, we sandbox Ember apps running in FastBoot such that they cannot access any built in Node.js features: no file IO, no network, etc.

However, FastBoot apps need to be able to fetch model data over the network, the same way they do in the browser. Historically, we've hardcoded the najax global to be available in the FastBoot context,

@tomdale
tomdale / proposal.md
Last active Oct 16, 2019
Ember Data / Ember Ajax / Ember Fetch proposal
View proposal.md

Networking in Ember

Motivation

Most client-side applications need to fetch data over the network. In the Ember.js ecosystem, many developers use a high-level abstraction, like Ember Data, that standardizes network access via an adapter pattern.

For those who want more low-level control over data fetching, it is

@tomdale
tomdale / gist:ad71ff9bf1227b687510
Created Jun 5, 2015
Shell function to start IR Hydra
View gist:ad71ff9bf1227b687510
irhydra () {
cd ~/irhydra
command rm -f *.cfg *.asm
command "/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary" --no-sandbox \
--js-flags="--trace-hydrogen \
--trace-phase=Z \
--trace-deopt \
--code-comments \
--hydrogen-track-positions \
--redirect-code-traces"
@tomdale
tomdale / gist:7d17530c12dbc104b15d
Created Nov 15, 2014
destructuring assignment example
View gist:7d17530c12dbc104b15d
// before
var displayAnnotation = config.displayAnnotation,
width = config.width,
axisHeight = config.axisHeight,
barsLeftMargin = config.barsLeftMargin,
barsRightMargin = config.barsRightMargin;
// after
var { displayAnnotation,
You can’t perform that action at this time.