Skip to content

Instantly share code, notes, and snippets.

View johnfmorton's full-sized avatar
⌨️
Making stuff

John F Morton johnfmorton

⌨️
Making stuff
View GitHub Profile
@johnfmorton
johnfmorton / gmail-htmlemail-gap-fix.css
Created January 31, 2013 14:26
Re: HTML email authoring and getting images in table cells to not cause gaps in Gmail. Making img display as blocks fixed that issue.
img {
display: block;
}
@johnfmorton
johnfmorton / dom_challenge1.html
Created October 20, 2010 17:21
change event capture times 1
<!-- 1. Change the addEventListener calls so that the events occur in the following order.
the_div! the_item! the_list! -->
<div id="the_div">
<ul id="the_list">
<li id="the_item">Click me!</li>
</ul>
</div>
<p id="log"></p>
@johnfmorton
johnfmorton / isItCreditCard.js
Created October 20, 2010 15:48
Is it a credit card function for JS class
Number.prototype.isCreditCard = (
function() {
var testCC = this.toString();
var sum =0; mul = 1; l = testCC.length;
if (l < 19) {
for (i = 0; i < l; i++)
{
var digit = testCC.substring(l-i-1,l-i);
var tproduct = parseInt(digit ,10)*mul;
@johnfmorton
johnfmorton / extendingNumber.js
Created October 20, 2010 14:32
Extending Number - class exercise
// ah, wrap the function in parentheses!
Number.prototype.times = (function(theString) {
this.theString = theString;
var result = "";
for (var i = 0; i< this; i++){
result += this.theString;
}
//return this + " ; " + this.theString;
return result;
var Person = function(name) {
this.name = name;
}
Person.prototype.getName = function() {
return this.name;
}
var thomas = new Person("thomas")
var Person = function(name) {
this.name = name;
}
Person.prototype.getName = function() {
return this.name;
}
var thomas = new Person("thomas")