Skip to content

Instantly share code, notes, and snippets.

@robertcasanova
robertcasanova / list.html
Created February 25, 2012 19:57
Micro Tmpl + RequireJS
<% for ( var i = 0; i < dataObject.length; i++ ) { %>
<article id="<%=dataObject[i].id%>" class="<%=(i % 2 == 1 ? "even" : "")%>">
<figure class="clearfix">
<img src="img/<%=i%>_<%=dataObject[i].profile_image_url%>" alt="<%=dataObject[i].id%>" title="<%=dataObject[i].id%>" />
<figcaption>
<strong><%=dataObject[i].id%></strong>
<span class="text"><%=dataObject[i].text%></span>
<span class="contact">Per contatti: <a href="mailto:<%=dataObject[i].from_user%>"><%=dataObject[i].from_user%></a></span>
</figcaption>
</figure>
@robertcasanova
robertcasanova / gist:1925212
Created February 27, 2012 16:35
Store Locator
var StoreLocator = {
stores: {},
resize: function(size) {
if(store_located)
$('.storeFinder',this.$layout).css('width',(size[0] - $('.closestStore').width() - 40 - 10));
$('.map',this.$layout).css('height',(size[1] - 407 - 5)); // 437 = $('#footer_main').height()
this.getCarouselLimit();
},
@robertcasanova
robertcasanova / gist:1941314
Created February 29, 2012 14:50
Notifications HTML5
if (window.webkitNotifications) {
if (window.webkitNotifications.checkPermission() == 0) {
var note = window.webkitNotifications.createNotification("", "Hi", "I'm a notification");
note.ondisplay = function(event) {
setTimeout(function() {
event.currentTarget.cancel();
}, 2000);
}
note.show();
}
@robertcasanova
robertcasanova / carousel.css
Created March 6, 2012 15:31
Cross device Carousel.
@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)
*/
@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);
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 / app.py
Created October 6, 2012 16:35
Python Stream Song from SoundCloud
import pygst
pygst.require("0.10")
import gst
import soundcloud
import sys
query = sys.argv[1] ##TODO try catch for no parameters
client = soundcloud.Client(client_id='xxx')
@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() {
@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);