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 User(data) { | |
Object.keys(data).forEach(function(theAttribute) { | |
this[theAttribute] = data[theAttribute]; | |
}); | |
this.save = function() { | |
promise_object = $.ajax({ | |
url: '/validate-user', type: 'post' | |
data: this.attributes, | |
headers: { |
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
class App extends Component { | |
handleClick = task(function*(component) { | |
component.setState({ label: component.props.pending }); | |
yield component.props.onClick(); | |
component.setState({ label: component.props.default }); | |
}) | |
render() { | |
... | |
} |
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
0x571E3B95af0FF865a746C33bf809BaA32740A434 |
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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
checked: true, | |
actions: { | |
toggle() { | |
this.toggleProperty('checked'); | |
} | |
} | |
}); |
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
import Ember from 'ember'; | |
const { TextField, computed } = Ember; | |
export default TextField.extend({ | |
attributeBindings: ['type', 'isChecked:checked'], | |
type: 'checkbox', | |
isChecked: computed('checkedItemsSet', function() { | |
return this.get('checkedItemsSet').has(this.get('item')); | |
}) |
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
import Ember from 'ember'; | |
const ForOf = Ember.Component.extend({ | |
tagName: '', | |
items: Ember.computed(function() { | |
return [...this.get('_items')]; | |
}) | |
}); | |
ForOf.reopenClass({ |
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
import Ember from 'ember'; | |
const { Component, computed } = Ember; | |
export default Component.extend({ | |
tagName: 'ul', | |
attributeBindings: ['data-test-hook'], | |
checkedItemsSet: computed('checkedItems.length', function() { | |
if (this.get('checkedItems')) { | |
return new Set(this.get('checkedItems').toArray()); |
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
FROM node:6.11.5-alpine | |
LABEL maintainer="David Tang" | |
ENV BOWER_VERSION=1.8.2 APP_DIR=/app PATH=/root/.yarn/bin:$PATH | |
RUN apk add --no-cache --virtual build-dependencies \ | |
bash \ | |
curl \ | |
git \ | |
gnupg \ |
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
require('dotenv').config(); | |
const request = require('request'); | |
const credentials = `${process.env.CONSUMER_KEY}:${process.env.CONSUMER_SECRET}`; | |
const credentialsBase64Encoded = new Buffer(credentials).toString('base64'); | |
request({ | |
url: 'https://api.twitter.com/oauth2/token', | |
method:'POST', | |
headers: { |
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
import environment from 'mcc/config/environment'; | |
console.log(environment.environment); // production, development, test | |
// should be | |
import environment from 'mcc/config/environment'; | |
console.log(environment.name); // production, development, test |