Posted by: damienhowley on: July 14, 2009
Do you have forms on your website for people to submit sales information? Do you get personal email addresses when you’re looking for business email addresses? Blocking the personal email addresses can be very advantageous to your sales process and can provide a much needed filter on the leads coming in.
Here’s a nice JavaScript function that validates the domain of an email address against a list of predefined blacklisted domains. You add more domains simply add another item to domarray. For instance you could have:
domarray[3] = “microsoft.”;
Additionally you can validate the domains as specific as possible:
domarray[3] = “gmail.jp”;
domarray[4] = “gmail.co.uk”;
domarray[5] = “gmail.kr”;
function chckDomain(em) {
var emat = em.substring(0,em.lastIndexOf(‘@’)+1);
var emdom = em.substring(emat.length,em.length+1);
var emdom = emdom.toLowerCase();
var domarray = Array();
domarray[0] = “gmail.”;
domarray[1] = “hotmail.”;
domarray[2] = “yahoo.”;
for (i=0; i < domarray.length ; i++) {
if (emdom.indexOf(domarray[i]) != -1) {
return false;
}
}
return true;
}
Enjoy
Damien
@DamienH
Posted by: damienhowley on: June 29, 2009
I work at MindTouch and earlier today I started looking around the web for an animated jQuery number ticker to display the real-time page views with ajax. After searching for a while I wasn’t able to find anything so I thought I might try to build one.
With jQuery it wasn’t too challenging and I was able to develop the ticker in no time at all. The script is flexible and adjusts to the number of digits in the number. It also adds commas to properly format the number. You can see how the ticker looks here displaying the number 786554 –
.

The jQuery code creates and removes the digits as needed and of the css is responsible for positioning the digits. The ticker is animated with jQuery which adds a nice touch. I got the number comma formatting from mrededkj.com. You’ll also need the following image that I created.
View the live Demo here at http://developer.mindtouch.com/User:Howleyda/Plain_Ticker.
<div class="counter-wrap">
<div class="counter-number">
</div>
</div>
<style>
.counter-wrap {
height:18px;
overflow:hidden;
}
.counter-number {
height:198px;
width:12px;
position:relative;
background-image:url(http://developer.mindtouch.com/@api/deki/files/4548/=counter_ticker_bg.gif);
float:left;
}
</style>
<script type="text/javascript">
$(".counter-number").each( function(i) {
$(this).attr('id','num'+i);
});
function loadinput() {
var newval = $("#numgo").val();
loadticker(newval);
}
function loadticker(ticnum) {
var fticnum = add_commas(ticnum);
var numheight=18;
addticker(fticnum);
if (ticnum && ticnum != 0) {
var s = String(fticnum);
for (i=s.length;i>=0; i–)
{
var onum=s.charAt(i);
$(“#num”+i).attr(‘value’,onum);
}
$(“.counter-number”).each( function() {
var nval=$(this).attr(“value”);
if (!isNaN(nval)) {
var nheight = Number(nval)*numheight*-1;
$(this).animate({ top: nheight+’px’}, 1500 );
}
if (nval==’,'){
$(this).animate({ top: ‘-180px’}, 1500 );
}
});
}
}
function addticker(newnum) {
var digitcnt = $(“.counter-number”).size();
var nnum = String(newnum).length;
var digitdiff = Number(nnum – Number(digitcnt));
if (digitdiff <0) {
var ltdig = (Number(nnum)-1);
$(“.counter-number:gt(” + ltdig + “)”).remove();
}
for(i=1;i<=digitdiff;i++) {
$(“.counter-wrap”).append(‘<div class=”counter-number” id=”num’ + (Number(digitcnt+i-1)) + ‘”> </div>’);
}
}
function add_commas(nStr) {
nStr += ”;
x = nStr.split(‘.’);
x1 = x[0];
x2 = x.length > 1 ? ‘.’ + x[1] : ”;
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1)) {
x1 = x1.replace(rgx, ‘$1′ + ‘,’ + ‘$2′);
}
return x1 + x2;
}
</script>
<a href="#" onclick="loadticker(786554)">load ticker - 786554</a>
<a href="#" onclick="loadticker(1767697234789837)">load ticker - 1767697234789837</a>
<a href="#" onclick="loadticker(1988989)">load ticker - 1988989</a>
I hope you enjoy this code, feel free to post any improvements as this was simply a prototype.
Thanks
Damien
@DamienH
Posted by: damienhowley on: June 27, 2009
After riding about 14 miles throughout San Diego we arrived at the Fashion Valley Mall. As we rode our bikes through the parking garage I thought this would be end point. Instead all 400+ Critical Mass riders made their way through the food court, down the ramps and finally everyone got stuck as the escalators.
After reaching the mall Aaron and I decided to head back home. We took a shortcut from Mission Valley up to Hillcrest which was fairly steep. After the hill Aaron and I parted and I headed home. All in all it was a great time, extremely entertaining.
Damien
Posted by: damienhowley on: June 25, 2009
This past weekend some friends and I climbed Mt. Whitney which is the highest mountain in the contiguous 48 states. The peak sits at an altitude of 14,497.61 feet and the campground is just around 8000ft.
We woke up around 2AM and started the hike around 3AM which gave us about 3 hours of night hiking. All in all the uphill hike took about 10 hours and we only got to 13,000 ft. We didn’t go the rest of the way because of improper equipment. We didn’t have crampons and ice axes which apparently were critical in order to make it past the ice cliffs
I took plenty of other photographs(205) and took some movies(16) that you can see at http://www.flickr.com/photos/damienhowley/sets/72157620426196020/.
I hope you enjoy
Damien
Posted by: damienhowley on: May 11, 2009
For those of you who don’t know, Friday May 15th is National “Bike To Work Day.” Unfortunately most people won’t ever consider riding a bike to work, which truly is a shame. So, as a bike commuter for the last three years, I thought that I’d share some of the reasons and benefits of my choice.
Exercise
If you’re like me you spend the better part of 10 hours a day sitting in front of a computer. Granted your fingers may be more chiseled than a 19 year old Schwarzenegger the rest of your body basically does nothing all day long. Add to that a diet of sausage pizza, Chinese takeout, doner kababs, breakfast burritos, donuts, ice cream and the rest… and well you’re not exactly living healthy.
Each day I ride approximately 3 miles to and from work. My bike ride to work is downhill and is quite easy whereas my bike ride home is uphill and usually accounts for about a 20 minute battle. At first my legs would get sore, now I can race the entire hill. I feel great when I get home and I physically can notice the difference.
The kicker in this scenario is that once you get to work on your bike you must return home on your bike so you’re forced to exercise. By the time I get home, I’m not tire! I feel great and am generally very productive due to a surge in energy.
Environment
We all know that when you don’t drive you save gas but there’s also another environmentally friendly result of riding your bike to work and it works exponentially. When you remove your car from the roads there is one less car congesting the roads. One car probably won’t make a difference but multiply that by 1000 or even 10,000 and all of a sudden the roads are much less congested. Less congestion results in less time on the road which ultimately burns less fuel.
This concept is typically not apparent to most people but one of the most energy inefficient activities is traffic. Thousands of cars waiting, burning oil and not getting to point B.
Vehicle Depreciation
Cars aren’t cheap and everyone always says that they “loose 20% the day they drive off the lot.” Not only that every year your car depreciates in value. Think about it, would you pay more for a 2006 car with 20,000 miles or 200,000 miles. Basically, as you run up the odometer on your car it looses value and biking to work keeps your mileage low, way low.
When I moved to San Diego 3 years ago I had 28,000 miles on my car. At the time I thought… not to bad for a 2 year old car. Well, I went to get my oil changed yesterday(5/10/09) and my mileage checked in at 32,221. So, in three years I have put just over 4,000 miles on my car. Consider this now, my girlfriend who’s car is two years newer than mine has over 64,000 miles on it and she didn’t drive from Cincinnati to San Diego three times (almost 7,000 miles).
Insurance Savings
This is another very overlooked area of savings when people look to alternative methods for commuting to work. Granted that getting rid of your car would save you the most money, it is usually not an option for most people. So, since you’ve decided to keep your car for emergencies and road trips why not get some more savings for your good-willed effort of riding your bike to work. Call up your insurance and tell them “I’m a good citizen, I’m riding my bike to work. Can you change my vehicle to a recreational vehicle?” Also let them know that you now will be driving less than 10,000 miles per year. This should save you anywhere from 15% to 40% on your insurance. For instance my insurance dropped from $105/month to $72/month.
Enjoyment of Riding your bike
How many times during your commute to work do you get cut-off, stuck in traffic or get yelled by another driver? I’m not a pleasant driver and I constantly was frustrated with my 15 minute commute to work. I’d always try to rush to get there faster and I would never sit back and relax. Now that I ride my bike to work I am much more relaxed. My bike ride goes past Balboa Park, down into the city and through our Little Italy district. It’s very peaceful and quite calming. I no longer have the stress associated with driving and it’s really nice. Not only that, I occasionally take different routes just to see different things.
So there you have it, 5 reason why riding your bike to work can give you peace of mind and save you money. Give it a shot, I think you’ll enjoy it!
Damien Howley
@DamienH