Skip to content

Instantly share code, notes, and snippets.

View taras's full-sized avatar

Taras Mankovski taras

View GitHub Profile
@taras
taras / WIP.md
Last active August 29, 2015 13:55
Using promises to connect nested components

promiseAction

AutoCompleteComponent = Ember.Component.extend({
  result: promiseAction(function(){
    return Em.$.ajax('/search?q=' + this.get('keyword'));
  });
});
@taras
taras / 0_reuse_code.js
Created February 2, 2014 23:45
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
6:01 PM <tarasm_> who’s here to talk about Ember Adoption Team and improving Ghost app prototype?
6:01 PM <Zaxnyd> good stuff. thanks for the enlightening chat. I'll revisit my design and I assume it will be much better :D
6:02 PM ⇐ petehunt quit (~petehunt@mpk-nat-4.thefacebook.com) Quit: petehunt
6:02 PM <jtal1> anyone know what that means?
6:02 PM <alexspeller> awesome, same to you
6:02 PM → guest12214 and pottersky joined
6:02 PM <Zaxnyd> alexspeller, http://media.tumblr.com/e3526a122eeb354aeac4aa20ef4b4963/tumblr_reply_mfw6l5q2TT1rv69u0.gif
6:03 PM ⇐ yuters quit (~yuters@135-23-195-114.cpe.pppoe.ca) Ping timeout: 272 seconds
6:03 PM <tarasm_> JohnONolan: you here?
6:03 PM <KerrickLong> So if I use an ArrayController, it can access its child controllers to send actions to them all. But each one doesn't get a view. If I use {{render}}, each one gets a view but the ArrayController can't reach its child controllers. Any way to get both?
@taras
taras / application.hbs
Last active August 29, 2015 13:57
This shows how to use promiseAction to handle result of a dialog.
{{render 'topbar'}}
{{cookie-alerts}}
{{outlet}}
{{modal-confirm
action=modalConfirm
isVisible=isVisibleModalConfirm
text=modalConfirmText
trueText=modalConfirmTrueText
falseText=modalConfirmFalseText}}
controller.setProperties({
title: 'Hello World',
slug: ''
})
console.log(controller.get('validation'));
{
title: {
isPassed: true,
var Night = Ember.Object.extend({
// Returns instance of moment for the given timestamp
moment: function() {
return window.moment(this.get("timestamp"));
}.property("timestamp"),
// Return formatted date
formatted: function() {
return this.get("moment").format("YYYY-MM-DD");
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
</body>
</html>
var DatasetEditController = DatasetIndexController.extend(BufferedProxy, {
setupNewRow: function() {
this.set('newRow', NewRowController.create({
parentController: this
}));
}.on('init')
}
// pre 0.9
module.exports = function(broccoli) {
var tree = broccoli.mergeTree('path');
return tree;
}
// 0.9
var tree = 'path'; // tree can also be a bunch of declerative statements that produce a tree (instead of a string)
module.exports = tree;
### Keybase proof
I hereby claim:
* I am taras on github.
* I am tarasm (https://keybase.io/tarasm) on keybase.
* I have a public key whose fingerprint is F827 2F95 BEDB 6738 E76C 38AD DAA3 4C3E 576E E3F8
To claim this, I am signing this object: