Skip to content

Instantly share code, notes, and snippets.

View balinterdi's full-sized avatar
👌
Enjoying life, including work.

Balint Erdi balinterdi

👌
Enjoying life, including work.
View GitHub Profile
@balinterdi
balinterdi / api.js
Created October 20, 2014 14:40
Ember-CLI http proxy config
var proxyPath = '/api';
module.exports = function(app) {
// For options, see:
// https://github.com/nodejitsu/node-http-proxy
var proxy = require('http-proxy').createProxyServer({});
var path = require('path');
app.use(proxyPath, function(req, res, next){
// Do not include root path in proxied request
@balinterdi
balinterdi / route.js
Created September 24, 2014 19:26
delay-model-resolve.js
function wait(value, timeout) {
return new Ember.RSVP.Promise(function(resolve, _) {
window.setTimeout(function() {
Ember.run(function() {
resolve(value);
});
}, timeout);
});
}
Ember.Application.initializer({
name: "i18n", // <- this
initialize: function(container, application) {
container.register('i18n:main', i18n);
}
});
Ember.Application.initializer({
name: "injectI18n",
@balinterdi
balinterdi / gist:00ad17faf5c9e9704f3c
Created September 15, 2014 20:18
controller_test.js
var stuntAnalytics;
moduleFor('controller:song', 'Unit - Song controller', {
needs: [
'controller:song'
],
setup: function() {
stuntAnalytics = MockAnalytics.create(); // create with a mock library, like sinon;
this.container.register('service:analytics', stuntAnalytics);
this.container.inject('controller', 'analytics', 'service:analytics');
@balinterdi
balinterdi / app.js
Created April 30, 2014 18:11
Using the no-no __container__.lookup for not knowing better
var App = Ember.Application.extend({
(...)
reset: function() {
this.__container__.lookup('store:main').clearCache();
this._super();
},
(...)
willDestroy: function() {
this.__container__.lookup('store:main').clearCache();
this._super();
@balinterdi
balinterdi / app.js
Last active August 29, 2015 13:57
A tiny Ember "app" to demonstrate property paths on
App = Ember.Application.create();
App.User = Ember.Object.extend({
name: ''
});
var cory = App.User.create({ name: "Cory Filibuster" });
App.Badge = Ember.Object.extend({
name: '',

Balint Erdi

Contact details

Speaker bio

{{#unless postStream.loadingFilter}}
{{cloaked-collection cloakView="post" idProperty="post_number" defaultHeight="200" content=postStream.posts slackRatio=slackRatio}}
{{/unless}}
<script type="text/x-handlebars" data-template-name="idea">
<li>
<div class="idea">
<div class="row">
<div class="span8">
<strong>{{title}}</strong>
</div>
<div class="span1">
{{voteCount}}
</div>
<script type="text/x-handlebars" data-template-name="ideas/new">
<div class="idea new-idea">
<div class="row">
<div class="span9">
{{input value=title placeholder="Your idea here" insert-newline="sendIdea"}}
</div>
<div class="span2">
{{#if isDisabled}}
<button disabled="disabled" {{bindAttr class="isDisabled:disabled"}}>Send my idea</button>
{{else}}