Skip to content

Instantly share code, notes, and snippets.

@MartinMalinda
MartinMalinda / .bashrc
Last active May 16, 2018 11:26
Aliases for Web Development on ChromeOS
export PATH="$PATH:$HOME/.npm-packages/bin"
alias cdwww="cd ~/Downloads/www" #This might be risky. If you choose to have your www directory in ~/Downloads, use version control to backup your projects frequently! ChromeOS might wipe the Download folder if there is data space shortage
alias cdd="cd ~/Downloads"
alias x="xiwi -t"
alias xw="xiwi -w"
alias emprod="ember build --environment=production"
alias npms="npm --save"
@MartinMalinda
MartinMalinda / 0_reuse_code.js
Last active September 13, 2015 14:35
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@MartinMalinda
MartinMalinda / emberInspectorExampleStore.js
Last active November 7, 2015 18:08
Accessing the DS.Store objet with Ember Inspector
// Creating a new object and saving it
temp1.store.createRecord('someModel', {attribute1: 'data', attribute2: 'data'}).save()
// Loading data from the server
temp1.store.query('someModel', {someParameter: true})
temp1.store.findAll('someModel')
@MartinMalinda
MartinMalinda / emberInspectorExampleActions.js
Last active November 7, 2015 19:55
Triggering Actions in the console
// list availible actions
tempObject._actions
tempComponent.send('some action')
tempController.send('some action')
tempRoute.send('some action')
@MartinMalinda
MartinMalinda / emberInspectorExampleSession.js
Created November 7, 2015 19:10
Altering the session object in Ember Inspector
tempSession.set('isAuthenticated', true)
tempSession.set('user', tempUserModel)
@MartinMalinda
MartinMalinda / emberInspectorExampleMiscellaneous.js
Created November 7, 2015 20:08
Miscellaneous Ember inspetor example
// redirect to any route
tempRoute.transitionTo('someOtherRoute', someParam)
// get a JSON object of any model
tempModel.toJSON()
// trigger events on objects
tempObject.trigger('someEvent', 'someParam');
// reload model
tempModel.reload()
// refresh Route
tempRoute.refresh()
import Ember from 'ember';
const {computed} = Ember;
export default Ember.Component.extend({
previousMessage: computed('index', function(){
return this.get('messages').objectAt(this.get('index') - 1)
}),
isDoublePost: computed('previousMessage.content', 'model.content', function(){
console.log(this.get('messages'));
@MartinMalinda
MartinMalinda / controllers.application.js
Last active June 7, 2016 09:16
Proper usage o debounce
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
sayHello(){
alert('hello');
},
actions: {
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
forms: [{
title: 'one',
content: ''
},
{
title: 'two',
import Ember from 'ember';
const {computed, on} = Ember;
const getFunctionName = function (fun) {
var ret = fun.toString();
ret = ret.substr('function '.length);
ret = ret.substr(0, ret.indexOf('('));
return ret;
};