Skip to content

Instantly share code, notes, and snippets.

View suhajdab's full-sized avatar

Balázs Suhajda suhajdab

View GitHub Profile
#include <Adafruit_NeoPixel.h>
// Pin used on Arduino board
#define PIN 2
// Number of NeoPixels
#define PIXELS 24
// Number of pixels on either side continuously orange to indicate side of vehicle
#define FIXEDPIXELS 1
// Parameter 1 = number of pixels in strip
#include <Adafruit_NeoPixel.h>
#define PIN 2
#define Pixels 24
#define BG 1
// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
#include <Adafruit_NeoPixel.h>
#define PIN 2
#define Pixels 25
// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
@suhajdab
suhajdab / rAF.js
Created January 8, 2013 10:30 — forked from paulirish/rAF.js
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller
// fixes from Paul Irish and Tino Zijdel
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
Here is an obfuscated email address: <a class="obsfuscated" href="#">moc.elpmaxe@zyx</a>.​​​
@suhajdab
suhajdab / bookmarklet.js
Created July 18, 2012 08:15
overview bookmarklet for ProData Hour Reporting page
var contracthours=165,hourrate=123,sum=0,now=new Date,firstday=1,nextday=now.getDate()-(now.getHours()<15?1:0),lastday=(new Date((new Date).setFullYear(now.getFullYear(),now.getMonth()+1,0))).getDate(),workdaysdone=0,workdaysleft=0,msg;for(var d=firstday;d<=lastday;d++){var day=new Date((new Date).setFullYear(now.getFullYear(),now.getMonth(),d)),weekday=day.getDay();if(weekday!==0&&weekday!==6){if(d<=nextday)workdaysdone++;else workdaysleft++}}[].slice.apply(document.querySelectorAll('span[id*="lblTimer"]')).forEach(function(a){sum+=parseFloat(a.innerText)||0});msg=contracthours+" total hours\n"+sum+" hours ("+Math.round(sum/workdaysdone*10)/10+" hours / workday) worked so far.\n"+(contracthours-sum)+" hours ("+Math.round((contracthours-sum)/workdaysleft*10)/10+" hours / workday) to go.\n"+Math.floor(sum*hourrate)+" dkk earned so far";alert(msg)
@suhajdab
suhajdab / prependChild.js
Created April 29, 2012 12:18
prependChild
Node.prototype.prependChild = function(el) {
this.childNodes[1]&&this.insertBefore(el, this.childNodes[1]) || this.appendChild(el);
}​
@suhajdab
suhajdab / fiddle.response.html
Created November 20, 2011 00:34
html5 video course subtitle
WEBVTT
1
00:00:13.000 --> 00:00:16.100
I heard about this <c.arduino>arduino</c> project, and I saw it online -
2
00:00:16.100 --> 00:00:20.100
- and I said 'Wow! <00:00:18.100>a lot of people are starting to talk about this. I should check it out!'
@suhajdab
suhajdab / html5 video snippet for TextMate
Created January 18, 2011 13:19
By default TextMate inserts a quicktime object when you drag a video file onto an html page. This is a simple html5 replacement. Simply open the Bundle Editor and find 'Insert QuickTime Movie' under HTML and replace the text in the command(s).
video="$TM_DROPPED_FILE"
echo -n "<video controls="controls" src="\"$video\" "></video>"