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 / colorVertex.html
Created August 20, 2013 12:14
Vertex Color with THREE.js
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
body {
background-color: #ffffff;
margin: 0;
overflow: hidden;
}
@robertcasanova
robertcasanova / gist:42069c755fbb0826192c
Created August 20, 2014 07:53
Button Click & Hold (AVR)
#define BTN_DEBOUCE 20 //ms
ISR(INT0_vect) {
uint16_t timer = 0;
while(bit_is_clear(PIND, PD2)) { // button hold down
timer++; // count how long button is pressed
_delay_ms(1);
}
if(timer > BTN_DEBOUCE) { // software debouncing button
@robertcasanova
robertcasanova / polygon.js
Created September 17, 2013 12:40
Create custom 2d polygon with THREE.js
////////////////////////////////////////////////////////////////////////////////
// Polygon Creation Exercise
// Your task is to complete the function PolygonGeometry(sides)
// which takes 1 argument:
// sides - how many edges the polygon has.
// Return the mesh that defines the minimum number of triangles necessary
// to draw the polygon.
// Radius of the polygon is 1. Center of the polygon is at 0, 0.
////////////////////////////////////////////////////////////////////////////////
/*global, THREE, Coordinates, $, document, window*/
@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 / breakpoint.js
Created November 21, 2013 08:41
Image Breakpointer
(function($,window, document, undefined){
var defaults = {
resizing: true
};
var BreakpointManager = function(element, options) {
this.el = element;
this.$el = $(element);
this.options = $.extend({}, defaults,options);
this.breakpoints = {};
@robertcasanova
robertcasanova / observer.js
Created August 27, 2013 14:09
Observer Pattern With Backbone: communication between objects.
var observer = {};
_.extend(observer,Backbone.Events);
//use
observer.trigger("keyboard:pressed",obj);
observer.on("keyboard:pressed", function(obj) {});
@robertcasanova
robertcasanova / Gruntfile.js
Created August 27, 2013 13:59
Testing with GRUNT + JASMINE
module.exports = function(grunt) {
'use strict';
// Project configuration.
grunt.initConfig({
jasmine : {
src : 'src/**/*.js',
options : {
specs : 'spec/**/*.js'
}
@robertcasanova
robertcasanova / masterThreeJS.html
Last active December 21, 2015 15:49
Master Template for THREE.JS projects. Forked from https://github.com/blackjk3/threejs-sublime
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
body {
background-color: #fff;
margin: 0;
overflow: hidden;
}
@robertcasanova
robertcasanova / breakpointer.js
Last active December 18, 2015 02:59
Breakpointer
(function($,window, document, undefined){
var defaults = {
resizing: true
}
var BreakpointManager = function(element, options) {
this.el = element;
this.$el = $(element);
this.options = $.extend({}, defaults,options);
this.breakpoints = {};