Skip to content

Instantly share code, notes, and snippets.

Avatar

Evan Solomon evansolomon

View GitHub Profile
View components.my-component.js
import Ember from 'ember';
export default Ember.Component.extend({
someData: 'hello'
didReceiveAttrs() {
console.log('didReceiveAttrs')
},
didUpdateAttrs() {
console.log('didUpdateAttrs')
}
View components.child-component.js
import Ember from 'ember';
export default Ember.Component.extend({
actions: {
clearPersonData() {
this.set('person', null)
}
}
});
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
contentHtml: Ember.String.htmlSafe(`
<p>Hello <strong>world</strong></p>
<p>This content has html like images</p>
<p><img src="http://placekitten.com.s3.amazonaws.com/homepage-samples/408/287.jpg"></p>
`)
});
View components.video-player.js
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'video',
attributeBindings: [
'autoplay',
'muted',
'height',
'width',
'poster',
View components.a11y-label.js
import Ember from 'ember';
const {
Component,
computed,
get,
guidFor
} = Ember;
export default Component.extend({
View gist:7ebcb5e4ae331e1997cd
.
├── JSONStream
│   ├── LICENSE.APACHE2
│   ├── LICENSE.MIT
│   ├── examples
│   │   └── all_docs.js
│   ├── index.js
│   ├── package.json
│   ├── readme.markdown
│   └── test
@evansolomon
evansolomon / xhr.js
Created May 21, 2015
Chrome 43 changed the way XMLHttpRequest objects get serialized to JSON. Almost all of the fields as missing now.
View xhr.js
var xhr = new XMLHttpRequest()
xhr.open('GET', 'http://requestb.in/155pmaz1')
xhr.onreadystatechange = function () {
if (xhr.readyState !== 4) return
var jsonifiedXhr = JSON.parse(JSON.stringify(xhr))
console.log(Object.keys(jsonifiedXhr))
}
xhr.send()
// Chrome 42
View gist:60de7441423f6444d8fa
This file has been truncated, but you can view the full file.
{"participants":303854,"now":1427930520000,"secondsLeft":60}
{"participants":303865,"now":1427930521000,"secondsLeft":60}
{"participants":303871,"now":1427930522000,"secondsLeft":60}
{"participants":303875,"now":1427930523000,"secondsLeft":60}
{"participants":303884,"now":1427930524000,"secondsLeft":60}
{"participants":303893,"now":1427930525000,"secondsLeft":60}
{"participants":303900,"now":1427930526000,"secondsLeft":60}
{"participants":303907,"now":1427930527000,"secondsLeft":60}
{"participants":303917,"now":1427930528000,"secondsLeft":60}
View gist:7dab16b72ec1561ee715
$ aws lambda get-event-source --uuid my-events-uuid
{
"Status": "OK",
"UUID": "my-events-uuid",
"LastModified": "2014-11-22T02:37:00.000+0000",
"BatchSize": 1,
"Parameters": {
"InitialPositionInStream": "TRIM_HORIZON"
},
"Role": "arn:aws:iam::acct-number:role/lambda_exec_role",
@evansolomon
evansolomon / gist:9535323
Created Mar 13, 2014
Even when you don't care about a stream's data, you need to make sure it's produced.
View gist:9535323
var https = require('https')
https.get('https://medium.com', function (res) {
res.on('end', function () {
console.log('You will never see this')
})
})
https.get('https://medium.com', function (res) {
// This sets the stream to flowing mode and makes sure it gets through all of its
You can’t perform that action at this time.