Skip to content

Instantly share code, notes, and snippets.

Avatar
🦍
Generating legacy code

Hector Zarco zzarcon

🦍
Generating legacy code
View GitHub Profile
@zzarcon
zzarcon / gist:9327872
Created Mar 3, 2014
Api league example
View gist:9327872
{
"league": {
"id": 1,
"match_ids": [
"129-140-league-1",
"130-139-league-1",
"131-138-league-1",
"132-137-league-1",
"133-136-league-1",
"134-135-league-1",
View gist:9343092
"prizes": [
{
"id" : 1,
"competition_type" : "league",
"level": "gold",
"ingots" : 28.000.000,
"money" : 400,
"transfer" : "promotion"
},
{
View gist:10102415
{
"matches": [
{
"id": "133-149-league-2",
"configuration_id": "133-149-league-2",
"start_time": "2014-04-04T14:56:43+02:00",
"league_id": 2,
"local_cup_id": null,
"competition_type": "league",
"home_team_id": 133,
View Gm cups
App.Tournament = DS.Model;
App.LocalCup = App.Tournament.extend();
App.Championship = DS.Model.extend({
type: DS.attr('string'), //champions-cup, challengue-cup, kerad-cup
tournament: DS.belongsTo('tournament'),
leagues: DS.hasMany('league')
});
View gist:67c4181f3544e2d48fdf
App.ApplicationSerializer = DS.ActiveModelSerializer.extend({
serializeHasMany: function(record, json, relationship) {
var key = relationship.key;
var json_key = key.singularize().decamelize() + '_ids';
var relationshipType = DS.RelationshipChange.determineRelationshipType(
record.constructor, relationship);
if (relationshipType === 'manyToNone' || relationshipType === 'manyToMany' || relationshipType === 'manyToOne') {
@zzarcon
zzarcon / reopen_model.js
Created Sep 30, 2014
Ember Data Model 'canReload'
View reopen_model.js
DS.Model.reopen({
canReload: function() {
return !this.get('isSaving') && !this.get('isReloading');
}.property('isSaving', 'isReloading')
});
View component_spec.js
var view;
module('Computed properties', {
setup: function() {
view = Ember.View.create({
template: Ember.Handlebars.compile(
'{{my-component name="hector"}}'
)
});
},
@zzarcon
zzarcon / foo_route.js
Last active Aug 29, 2015
Route dependencies
View foo_route.js
App.FooRoute = App.Route.extend({
dependencies: ['session.team.championship', 'session.team.teamReport', 'customDependency','position', 'user:12345', 'lineup:cached'],
customDependency: function() {
return new Ember.RSVP.Promise();
}
});
View gist:9f643182ca51d8d1b3eb
App.ApplicationRoute = Em.Route.extend({
actions: {
showModal: function() {
//Quiero que entre aqui
}
}
})
App.ParentComponent = Em.Component.extend({
actions: {
@zzarcon
zzarcon / data.txt
Last active Oct 6, 2015
Samsung Galaxy S3 Component performance report
View data.txt
Resume: "Show view" took 16sec to load + initial fetching and app rendering
COMPONENT NAME | OCURRENCES | TOTAL TIME | AVERAGE
component:rt-icon 101 875 9
component:rt-arrow 4 228 57
component:rt-link-to 113 1785 16
component:rt-offer-slidedown 1 202 202
component:rt-user-avatar 19 1067 56
component:rt-input 4 153 38