Skip to content

Instantly share code, notes, and snippets.

View aureliosaraiva's full-sized avatar

Aurélio Saraiva aureliosaraiva

View GitHub Profile
import Ember from 'ember';
const { $, Component } = Ember;
export default Component.extend({
clickHandler() { /* -- */ },
clickHandlerRef: null,
didInsertElement(...args) {
import Ember from 'ember';
const { $, Component } = Ember;
export default Component.extend({
clickHandler() { /* -- */ },
didInsertElement(...args) {
this._super(...args);
$(this.element).on('click', this.clickHandler.bind(this));
//app/components/my-component.js
import Ember from 'ember';
export default Ember.Component.extend({
firstName: '',
lastName: '',
fullName: Ember.computed('firstName', 'lastName',
function () {
@aureliosaraiva
aureliosaraiva / components.my-component.js
Created November 16, 2016 00:56
Example - Test Computed
import Ember from 'ember';
export default Ember.Component.extend({
firstName: '',
lastName: '',
fullName: Ember.computed('firstName', 'lastName',
function () {
return `${this.get('firstName')} ${this.get('lastName')}`;
}
const Person = Ember.Object.extend({
fullName: Ember.computed('firstName', 'lastName',
function (key) {
console.log('call fullName');
return `${this.get('firstName')} ${this.get('lastName')}`;
}
),
})
const client = Person.create();
import Ember from 'ember';
const { observer, computed } = Ember;
//app/components/book.js
Ember.Component.extend({
setPage: observer('pageNumber',
function () {
const pageNumber = this.get('pageNumber');
this.set('page', this.store.find('page', pageNumber));
}
),
@aureliosaraiva
aureliosaraiva / feed_service.js
Last active November 11, 2016 01:35
feed_service.js
// app/services/feed.js
export default Ember.Service.extend(Ember.Evented);
// app/components/activity-feed.js
export default Ember.Component.extend({
feedService: Ember.inject.service('feed'),
activities: [], // the template will display this array
2016-02-13T01:34:26.777-0500 I WRITE [conn121] remove livrio.history_search ndeleted:37937 keyUpdates:0 writeConflicts:0 numYields:296 locks:{ Global: { acquireCount: { r: 38234, w: 38234 } }, Database: { acquireCount: { w: 38234 } }, Collection: { acquireCount: { w: 297 } }, Metadata: { acquireCount: { w: 37937 } }, oplog: { acquireCount: { w: 37937 } } } 1028ms
2016-02-13T01:34:26.780-0500 I COMMAND [conn121] command livrio.$cmd command: delete { delete: "history_search", deletes: [ { q: {}, limit: 0 } ] } keyUpdates:0 writeConflicts:0 numYields:0 reslen:100 locks:{ Global: { acquireCount: { r: 38234, w: 38234 } }, Database: { acquireCount: { w: 38234 } }, Collection: { acquireCount: { w: 297 } }, Metadata: { acquireCount: { w: 37937 } }, oplog: { acquireCount: { w: 37937 } } } protocol:op_query 1032ms
2016-02-13T01:35:14.928-0500 E STORAGE [conn121] WiredTiger (12) [1455345314:927682][2076:0x7f5a89036700], file:collection-10--5532199445362019960.wt, WT_CURSOR.insert: memory allocation of 1050 bytes f
2016-02-07T18:51:26.546-0500 I REPL [ReplicationExecutor] transition to SECONDARY
2016-02-07T18:51:27.146-0500 I REPL [ReplicationExecutor] syncing from: MASTER_SERVER:27017
2016-02-07T18:51:27.211-0500 I REPL [SyncSourceFeedback] setting syncSourceFeedback to MASTER_SERVER:27017
2016-02-07T18:51:27.271-0500 I ASIO [NetworkInterfaceASIO-BGSync-0] Successfully connected to MASTER_SERVER:27017
2016-02-07T18:51:31.122-0500 I REPL [ReplicationExecutor] Member MASTER_SERVER:27017 is now in state PRIMARY
2016-02-07T18:56:09.402-0500 I COMMAND [conn1] command admin.$cmd command: replSetHeartbeat { replSetHeartbeat: "rs0", configVersion: 10811, from: "MASTER_SERVER:27017", fromId: 0, term: 12 } keyUpdates:0 writeConflicts:0 numYields:0 reslen:351 locks:{} protocol:op_command 123ms
2016-02-07T18:56:12.169-0500 I COMMAND [ftdc] serverStatus was very slow: { after basic: 20, after asserts: 30, after connections: 60, after extra_info: 640, after globalLock: 650, after locks: 650, after network: 650,
2016-02-07T18:53:32.464-0500 I NETWORK [initandlisten] connection accepted from 127.0.0.1:43299 #19 (12 connections now open)
2016-02-07T18:53:39.951-0500 I NETWORK [conn18] end connection 107.170.138.18:38003 (11 connections now open)
2016-02-07T18:53:55.913-0500 I NETWORK [initandlisten] connection accepted from 107.170.138.18:38005 #20 (12 connections now open)
2016-02-07T18:53:56.033-0500 I WRITE [conn20] remove livrio.accounts ndeleted:2244 keyUpdates:0 writeConflicts:0 numYields:17 locks:{ Global: { acquireCount: { r: 2262, w: 2262 } }, Database: { acquireCount: { w: 2262 } }, Collection: { acquireCount: { w: 18 } }, Metadata: { acquireCount: { w: 2244 } }, oplog: { acquireCount: { w: 2244 } } } 117ms
2016-02-07T18:53:56.034-0500 I COMMAND [conn20] command livrio.$cmd command: delete { delete: "accounts", deletes: [ { q: {}, limit: 0 } ] } keyUpdates:0 writeConflicts:0 numYields:0 reslen:100 locks:{ Global: { acquireCount: { r: 2262, w: 2262 } }, Database: { acquireCount: { w: 2262 } }, Collectio