Skip to content

Instantly share code, notes, and snippets.

/*
Based off of "sweep" by Barragan:
https://www.arduino.cc/en/Tutorial/Sweep
*/
#include <Servo.h>
Servo myservo; // create servo object to control a servo
int pos = 90; // variable to store the servo position
int const potPin = A0;
@toddaeverett
toddaeverett / gist:4514107
Created January 11, 2013 21:29
Character limiter for textarea boxes. Keeps character count from going over a set limit, even if pasting text in. Might need jquery to work. Not sure.
<script language="JavaScript">
function limiter( event, field, limit ) {
backspace = 8;
del = 46;
tab = 9;
if( !event ) event = window.event;
key = ( event.which ? event.which : event.keyCode );
//display_field.innerHTML += String.fromCharCode(key);
field_text = field.value;
@toddaeverett
toddaeverett / gist:3405686
Created August 20, 2012 16:45
Top Navigation using sprites
#topnav {width:960px;height:50px;margin-top:0;background:url(images/topnavBG.jpg);}
#topnav ul{width:759px;height:40px;background:url(images/TNSprites.jpg);margin:0;padding:0;position:relative;}
#topnav ul li {margin:0;padding:0;list-style:none;position:absolute;top:0;background:none;}
#topnav ul li, #topnav ul li a {height:40px;display:block;}
#topnav ul li a {text-indent:-9000px;text-decoration:none;}
#topnav ul li a:focus {-moz-outline-style:none;outline:none;}
#TNhome {left:0; width:71px;}
#TNcourses {left:72px; width:154px;}
#TNgeneralinfo {left:226px; width:157px;}
@toddaeverett
toddaeverett / gist:3405635
Created August 20, 2012 16:38
Breadcrumb Navigation CSS
/* Breadcrumb Nav */
#breadcrumb {padding-top:10px;font-size:10px;}
#breadcrumb ul {margin:0px;padding:0px;}
#breadcrumb ul li {display:inline;padding:0px;margin:0 5px 0 0;color:#989898;background:none;}
#breadcrumb ul li a, #breadcrumb ul li a:hover {background:url(images/breadcrumbArrowR.gif) 100% 4px no-repeat;padding:0px 8px 0px 0px;}
#breadcrumb ul li a {text-decoration:underline;color:#69F;}
#breadcrumb ul li a:hover {text-decoration:underline;color:#f00;}
/* End Breadcrumb Nav */
@toddaeverett
toddaeverett / gist:3405621
Created August 20, 2012 16:37
Form Starter
<form id="" action="" method="">
<fieldset>
<legend></legend>
<p><label for=""></label><br />
<input type="text" name="" style="width:135px;" maxlength="35" /></p>
<p><input type="checkbox" name="" value="" /> <label for=""></label></p>
<p><label for=""></label><br />
@toddaeverett
toddaeverett / gist:3405614
Created August 20, 2012 16:35
Get rid of dotted borders around links in FF; use with image replacement technique
a:focus {-moz-outline-style:none;outline:none;}
@toddaeverett
toddaeverett / gist:3405605
Created August 20, 2012 16:33
Tables: setting padding, column width and column text-align via CSS
<!-- The CSS part -->
table.week tbody tr td {padding:10px;text-align:center;background:url(../images/dots439bbe.png) repeat-x 0 100%;}
table.week tbody tr td[headers=title] {width:191px;text-align:left;}
table.week tbody tr td[headers=date] {width:100px;}
table.week tbody tr td[headers=host] {width:52px;}
table.week tbody tr td[headers=cost] {width:40px;}
table.week tbody tr td[headers=notes] {text-align:left;}
<!-- The HTML part -->
<table cellspacing="0" class="week" id="week1">
@toddaeverett
toddaeverett / gist:3405594
Created August 20, 2012 16:32
Image replacement for form submit button
input#submit_btn {text-indent:-9000px;width:24px;height:24px;background:url(../images/go_btn.png) no-repeat 0 0;border:none;cursor:pointer;text-transform:capitalize;} /* text-transform:capitalize makes the negative text indent work in IE */
@toddaeverett
toddaeverett / gist:3405569
Created August 20, 2012 16:30
Create "array.indexOf" function in IE
// create "Array.indexOf" function in IE
if(!Array.prototype.indexOf){
Array.prototype.indexOf=function(obj,start){
for(var i=(start||0),j=this.length;i<j;i++){
if(this[i]==obj){return i;}
}
return -1;
}
}
hr { height:1px; border:none; background-color:#DEDEDE; color:#DEDEDE; }