Skip to content

Instantly share code, notes, and snippets.

@rmoura-92
rmoura-92 / fb_post2wall
Created May 2, 2013 22:51
fb_post2wall
require 'src/facebook.php';
$facebook = new Facebook(array(
'appId' => 'app_ip',
'secret' => 'app_secret_id',
));
$message = 'hello world';
$user = $facebook->getUser();
$token = $facebook->getAccessToken();
var that = this;
this.HoteisColl.on('reset', function(response) {
var obj = _.first(response.toJSON());
var searchId = obj.searchId;
var fileCod = obj.fileCod;
that.HoteisColl.options.fileCod = fileCod;
if(searchId) {
that.navigate('hoteis/'+searchId, {trigger:true});
showHoteis: function() {
var that = this;
// Layout options
this.Navigation.select('hoteis');
this.Section.render();
this.Section.holdBackground();
this.Section.changeHeadingContent('As nossas Sugestões');
this.Section.startLoading();
showEscapadinhaDetalhe: function(id, provider) {
Application.Views.Common.destroy();
Application.Views.Common.startLoading();
var item = Application.Collections.Escapadinhas.get(id);
Application.Views.Escapadinhas.Detalhe = new DetalheView({model:item});
Application.Views.Escapadinhas.SideView = new SideView({model:Application.Collections.Escapadinhas, section:"escapadinhas", id:id});
define([
'jquery',
'underscore',
'backbone',
'router',
'collections/voos',
'collections/hoteis',
'collections/ferias',
'collections/escapadinhas',
require.config({
baseUrl: 'js',
shim: {
'jquery': { exports: '$' },
backbone: { deps: ['jquery','underscore'], exports: 'Backbone' },
underscore: { exports: '_' },
'underscore-string': { deps: ['underscore'] }
},
paths: {
jquery: 'vendor/jquery.min',
dim = [19, 119]; // exemplo
var group, lastgroupsize;
_.each(dim, function(item, index) {
if(index == 0) {
lastgroupsize = item;
if(i < item) {
group = index;
@rmoura-92
rmoura-92 / viagem.js
Created July 30, 2013 13:08
Model nesting
define([
'underscore',
'backbone',
], function(_, Backbone){
var ViagemModel = Backbone.Model.extend({
idAttribute: 'id',
initialize: function() {
that.getDetalhes();
},
@rmoura-92
rmoura-92 / home.js
Created August 21, 2013 17:35
modalbox
// Filename: home.js
define(['jquery','underscore','backbone', 'text!tpl/home.html', 'text!tpl/start.html'],
function($, _, Backbone, homeTpl, startTpl) {
var HomeView = Backbone.View.extend({
el: 'body',
special: true,
events: {
'click a.special': 'special',
@rmoura-92
rmoura-92 / router.js
Created August 22, 2013 16:21
model increasing views
hoteis: function() {
App.CurrentView = 'hoteis';
App.Collections.Hoteis.getDestaques();
App.Collections.Hoteis.on('destaque', function(response) {
if(App.Views.Home && App.Views.Start) {
var home = App.Views.Home;
var start = App.Views.Start;
home.hide();