Skip to content

Instantly share code, notes, and snippets.

View pilaf's full-sized avatar

Pedro Fayolle pilaf

  • Beezwax Datatools Inc.
View GitHub Profile
var get = Ember.get;
var forEach = Ember.EnumerableUtils.forEach;
var camelize = Ember.String.camelize;
var pluralize = new Ember.Inflector();
App.EmbeddedRecordsMixin = Ember.Mixin.create({
/**
Serialize `belongsTo` relationship when it is configured as an embedded object.
/**
Ember Data: Dependent Relationships
This package extends Ember Data to support creating relationships
where a model's dirty state depends not only on its own attributes
but on the dirty state of models in dependent relationships as well.
```javascript
App.Thing = DS.Model.extend({
name : DS.attr('string'),
/**
Ember Data: Dependent Relationships
This package extends Ember Data to support creating relationships
where a model's dirty state depends not only on its own attributes
but on the dirty state of models in dependent relationships as well.
```javascript
App.Thing = DS.Model.extend({
name : DS.attr('string'),
@pilaf
pilaf / slides.md
Last active December 11, 2015 23:08

title: Beezwax.net remastering layout: true class: center, middle, inverse

#Beezwax.net remastering

Foobar

@pilaf
pilaf / time.rb
Created February 10, 2016 01:34
Code golf - Time
gets
puts"%9s
%5s%8s
%s%14s
%s%16s
%s%14s
@pilaf
pilaf / candy.rb
Last active January 27, 2017 20:27
Favorite candy
#== Migrations
class CreateUsers < ActiveRecord::Migration[5.0]
def change
create_table :users do |t|
t.string :name
t.timestamps
end
end
end
@pilaf
pilaf / abandon_hope.rb
Created May 16, 2017 20:14
DSL brainstorming for Magic implementation in Ruby
class AbandonHope < Magic::Card
# short for:
# name "Abandon Hope"
# cost "{X}{1}{B}"
head "Abandon Hope", "{X}{1}{B}"
# short for `type :sorcery`
sorcery
text "As an additional cost to cast :name, discard X cards",