This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Convert a nodejs http request into an AWS API Gateway 'event' object. | |
* Or apply middleware to automatically convert requests/responses. | |
* Useful for testing your API Gateway lambda handler locally. | |
*/ | |
import { IncomingMessage, IncomingHttpHeaders, ServerResponse } from 'http' | |
import { URL, URLSearchParams } from 'url' | |
import { APIGatewayProxyHandler, APIGatewayProxyResult } from 'aws-lambda' | |
const noop = () => {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ts = require('typescript') | |
const DefaultOptions = { | |
noEmit: true, | |
target: ts.ScriptTarget.ES2019, | |
module: ts.ModuleKind.CommonJS | |
} | |
function typecheck(filepath, options = DefaultOptions) { | |
const program = ts.createProgram([filepath], options) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(Ember) { | |
/** | |
Transforms a string so that it may be used as part of a 'pretty' / SEO friendly URL. | |
```javascript | |
'My favorite items.'.parameterize(); // 'my-favorite-items' | |
'action_name'.parameterize(); // 'action-name' | |
'100 ways Ember.js is better than Angular.'.parameterize(); // '100-ways-emberjs-is-better-than-angular' | |
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ember.GoogleAnalytics = Ember.Mixin.create({ | |
trackPageView: function() { | |
if(!Ember.isNone(ga)) { | |
Ember.run.next(function() { | |
var loc = window.location, | |
page = loc.hash ? loc.hash.substring(1) : loc.pathname + loc.search; | |
ga('send', 'pageview', page); | |
}); | |
} |