Skip to content

Instantly share code, notes, and snippets.

View zzarcon's full-sized avatar
🦍
Generating legacy code

Hector Zarco zzarcon

🦍
Generating legacy code
View GitHub Profile
@zzarcon
zzarcon / gist:9327872
Created March 3, 2014 15:51
Api league example
{
"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",
@zzarcon
zzarcon / gist:9343092
Created March 4, 2014 09:25
Prizes API
"prizes": [
{
"id" : 1,
"competition_type" : "league",
"level": "gold",
"ingots" : 28.000.000,
"money" : 400,
"transfer" : "promotion"
},
{
@zzarcon
zzarcon / gist:10102415
Created April 8, 2014 08:46
League matches
{
"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,
@zzarcon
zzarcon / Gm cups
Last active August 29, 2015 14:02
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')
});
@zzarcon
zzarcon / gist:67c4181f3544e2d48fdf
Created July 9, 2014 20:47
Serialized hasMany
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 September 30, 2014 10:58
Ember Data Model 'canReload'
DS.Model.reopen({
canReload: function() {
return !this.get('isSaving') && !this.get('isReloading');
}.property('isSaving', 'isReloading')
});
@zzarcon
zzarcon / foo_route.js
Last active August 29, 2015 14:07
Route dependencies
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();
}
});
@zzarcon
zzarcon / component_spec.js
Created October 20, 2014 10:08
Components tests
var view;
module('Computed properties', {
setup: function() {
view = Ember.View.create({
template: Ember.Handlebars.compile(
'{{my-component name="hector"}}'
)
});
},
App.ApplicationRoute = Em.Route.extend({
actions: {
showModal: function() {
//Quiero que entre aqui
}
}
})
App.ParentComponent = Em.Component.extend({
actions: {
@zzarcon
zzarcon / data.txt
Last active October 6, 2015 14:48
Samsung Galaxy S3 Component performance report
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