Skip to content

Instantly share code, notes, and snippets.

Enjoying life, including work.

Balint Erdi balinterdi

Enjoying life, including work.
Block or report user

Report or block balinterdi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
import Ember from 'ember';
export default Ember.Component.extend({
myFirstAction: '',
actions: {
myComponentAction() {
import Ember from 'ember';
export default Ember.Component.extend({
myColor: 'red',
View controllers.application.js
import Ember from 'ember';
function loadAndSave(loadingProperty, operation) {
this.set(loadingProperty, true);
return operation.finally(() => {
this.set(loadingProperty, false);
export default Ember.Controller.extend({
balinterdi / songs_controller.rb
Created Sep 23, 2016
Some non-working ways to use jsonapi_resources primitives to craft a response
View songs_controller.rb
class SongsController < ApplicationController
def index
# params[:bandId], params[:q]
serializer =
resource =, context)
render json: serializer.serialize_to_hash(resource)
def index
balinterdi / destructuring.js
Last active Sep 6, 2016
Fooling around with ES2015 destructurings
View destructuring.js
var pearlJam = {
members: [
{ firstName: 'Eddie', lastName: 'Vedder' },
{ firstName: 'Mike', lastName: 'McCready' },
{ firstName: 'Jeff', lastName: 'Ament' },
let { members: [ eddieVedder ] } = pearlJam;
let { firstName: eddie } = eddieVedder;
balinterdi / person.js
Created Jun 20, 2016
Composing `friendships` from the constituent parts - doesn't work
View person.js
export default Model.extend({
name: DS.attr(),
frienderFriendships: DS.hasMany('friendship', { inverse: 'friender' }),
friendedFriendships: DS.hasMany('friendship', { inverse: 'friended' }),
friendships: Ember.computed('frienderFriendships', 'friendedFriendships', function() {
let friendedFriendshipsRel = this.hasMany('friendedFriendships');
let frienderFriendshipsRel = this.hasMany('frienderFriendships');
let frienderFriendships;
balinterdi / route.js
Created Jun 20, 2016
Eager-fetch belongsTo relationships – does not work
View route.js
model(params) {
return'person', params.person_id)
.then((person) => {
return {
friendships: person.get('friendships', { include: 'friender,friended' }),
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
balinterdi / ga-events.js
Created Mar 4, 2016
Prevent GA to report too high of a bounce rate for your "one page at one visit" site (a landing page or a blog)
View ga-events.js
// Fire an event so that GA doesn't count it as a "bounce"
function readPage() {
ga('send', {
'hitType': 'event',
'eventCategory': 'engagement',
'eventAction': 'read'
balinterdi / app.css
Last active Feb 3, 2016
Binding style attributes warning in Ember
View app.css
body {
margin: 12px 16px;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 12pt;
.bordered {
border: 1px solid blue;
height: 100px;
You can’t perform that action at this time.