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({ | |
init() { | |
this._super(...arguments); | |
this.set('ads', [ | |
Ember.Object.create({ rotationWeight: 3 }), | |
Ember.Object.create({ rotationWeight: 5 }), | |
Ember.Object.create({ rotationWeight: 2 }), | |
Ember.Object.create({ rotationWeight: 1 }) |
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
<?php | |
class ShoppingCart { | |
protected $lineItems = []; | |
public function add($lineItem) | |
{ | |
$this->lineItems[] = $lineItem; | |
} |
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
// scraping from the page | |
function getPosts() { | |
let domPosts = Array.from(document.querySelectorAll('.postArticle')).reverse(); | |
return domPosts.map((domPost) => { | |
return { | |
href: domPost.querySelector('.js-postField').parentNode.href, | |
title: domPost.querySelector('h3').textContent.trim(), | |
date: domPost.querySelector('time').getAttribute('datetime') | |
}; | |
}); |
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
[{ | |
"href": "https://medium.com/basecs/bits-bytes-building-with-binary-13cb4289aafa?source=---------1----------------", | |
"title": "Bits, Bytes, Building With Binary", | |
"date": "2017-01-02T18:06:03.798Z" | |
}, { | |
"href": "https://medium.com/basecs/hexs-and-other-magical-numbers-9785bc26b7ee?source=---------0----------------", | |
"title": "Hexes and Other Magical Numbers", | |
"date": "2017-01-09T11:02:01.559Z" | |
}, { | |
"href": "https://medium.com/basecs/whats-a-linked-list-anyway-part-1-d8b7e6508b9d?source=---------24----------------", |
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.Component.extend({ | |
}); |
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.Component.extend({ | |
click() { | |
this.get('onClick')(); | |
} | |
}); |
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 { Checkbox, computed } = Ember; | |
export default Checkbox.extend({ | |
attributeBindings: ['checked'], | |
checked: computed('checkedItemsSet', function() { | |
return this.get('checkedItemsSet').has(this.get('item')); | |
}), | |
didInsertElement() { |
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 myAsyncFunction() { | |
doSomethingAsync1(function(error, data1) { | |
doSomethingAsync2(data1, function(error, data2) { | |
console.log(data2); | |
}); | |
}); | |
} |
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({ | |
appName: 'Ember Twiddle' | |
}); |