Skip to content

Instantly share code, notes, and snippets.

@robertcasanova
robertcasanova / mixin.js
Last active December 10, 2015 03:18
Using Mixin for sharing code within different Views
App.Mixins.Navigation = {
toggle: function() { /* ... */ },
open: function() { /*... */ },
close: function() { /* ... */ }
};
@robertcasanova
robertcasanova / gist:4373260
Last active December 10, 2015 03:18
Custom events and subviews with Backbone
App.SidebarView = Backbone.View.extend({
toggle: function() {
if ($(this.el).is(':visible')) {
$(this.el).hide();
this.trigger('collapse'); // <==
} else {
$(this.el).show();
this.trigger('expand'); // <==
}
},
@robertcasanova
robertcasanova / app.js
Created November 26, 2012 17:30
Backbone APP
(function($,_,global) {
var App = {
init: function() {
var class_name = $('#page').attr('class');
switch (class_name) {
case 'hp' : {
new App.View.Home.Boxed();
new App.View.Home.Cover();
new App.View.Home.Perfume();
}
@robertcasanova
robertcasanova / menu.ino
Created November 22, 2012 12:05
LCD Menu
#include <LiquidCrystal.h> //this library is included in the Arduino IDE
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
const int BTN_LEFT = 9;
const int BTN_RIGHT = 8;
const int BTN_CONFIRM = 10;
long last_read = 0;
@robertcasanova
robertcasanova / writeIP.ino
Created October 27, 2012 10:01
Print IP to LCD
#include <LiquidCrystal.h>
String buffer;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
boolean isPacket = false;
void setup() {
Serial.begin(9600);
lcd.begin(20, 2);
}
@robertcasanova
robertcasanova / loading.ino
Created October 18, 2012 21:37
Loading Arduino
/*
This is an adaptation of Hello World code from Liquid Crystal Examples
*/
// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
@robertcasanova
robertcasanova / arduino.ino
Created October 18, 2012 10:15
Simple Communication: Raspberry -> Arduino
int output = 9;//embedded led output, maybe is 13
void setup() {
Serial.begin(9600);
pinMode(output, OUTPUT);
}
void loop() {
cap to_stage deploy !2459
* executing `to_stage'
* executing `deploy'
* executing `deploy:update'
** transaction: start
* executing `deploy:update_code'
executing locally: "git ls-remote . develop"
command finished in 270ms
* executing "git clone -q --depth 1 git@github.com:HartSrlMassimilianoVentimiglia/boscolo_community.git /storage/vhosts/boscolo.stage.h-art.it/app/releases/20120926141455 && cd /storage/vhosts/boscolo.stage.h-art.it/app/releases/20120926141455 && git checkout -q -b deploy cacb271212cb08b82b19e306f5a7f9ce3b8f136e && (echo cacb271212cb08b82b19e306f5a7f9ce3b8f136e > /storage/vhosts/boscolo.stage.h-art.it/app/releases/20120926141455/REVISION)"
servers: ["147.123.242.2"]
@robertcasanova
robertcasanova / JS
Created June 26, 2012 10:22
YouTube
var YouTube = {
options: {
tag: 'toyota_social',
author: 'ToyotaItalia',
items_per_page: 6,
start_index:1
},
init: function(options) {
this._setURL(options);
@robertcasanova
robertcasanova / ga_social_tracking.js
Created April 24, 2012 10:27
Tracking Socials on Analytics (from Google)
// Copyright 2012 Google Inc. All Rights Reserved.
/**
* @fileoverview A simple script to automatically track Facebook and Twitter
* buttons using Google Analytics social tracking feature.
* @author api.nickm@gmail.com (Nick Mihailovski)
* @author api.petef@gmail.com (Pete Frisella)
*/