Skip to content

Instantly share code, notes, and snippets.

var paper = Raphael(0, 0, 400, 400);
var r = 100;
var steps = 120;
var totLed = 48;
// Sets the fill attribute of the circle to red (#f00)
var circles = [];
// Sets the stroke attribute of the circle to white
var alpha = 0;
@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 / laserPrinted.dru
Created June 29, 2014 10:57
Eagle Design Rules for laser printed circuits
description[it] = <b>EAGLE Design Rules</b>\n<p>\nThe default Design Rules have been set to cover\na wide range of applications. Your particular design\nmay have different requirements, so please make the\nnecessary adjustments and save your customized\ndesign rules under a new name.
layerSetup = (1*16)
mtCopper = 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm
mtIsolate = 1.5mm 1.5mm 1.5mm 1.5mm 1.5mm 1.5mm 1.5mm 1.5mm 1.5mm 1.5mm 1.5mm 1.5mm 1.5mm 1.5mm 1.5mm
mdWireWire = 0.8mm
mdWirePad = 0.8mm
mdWireVia = 0.8mm
mdPadPad = 0.45mm
mdPadVia = 0.8mm
mdViaVia = 0.8mm
{
"user": {
"debug": false,
"delay": 0.25,
"error_color": "D02000",
"gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme",
"gutter_theme_excludes": [],
"lint_mode": "save only",
"linters": {
"csslint": {
@robertcasanova
robertcasanova / Makefile
Created June 15, 2014 15:26
Makefile AVR
##########------------------------------------------------------##########
########## Project-specific Details ##########
########## Check these every time you start a new project ##########
##########------------------------------------------------------##########
MCU = atmega328p
F_CPU = 1000000
BAUD = 9600
## Also try BAUD = 19200 or 38400 if you're feeling lucky.
@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 / 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 / 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'
}