Skip to content

Instantly share code, notes, and snippets.

@madrobby
madrobby / LICENSE.txt
Created August 1, 2011 21:34 — forked from 140bytes/LICENSE.txt
lettering.js
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Thomas Fuchs <http://mir.aculo.us/>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@madrobby
madrobby / LICENSE.txt
Created May 19, 2011 14:46 — forked from 140bytes/LICENSE.txt
Mock objects
Copyright (c) 2011 Thomas Fuchs, http://mir.aculo.us/
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
@madrobby
madrobby / README.md
Created May 17, 2011 16:34 — forked from 140bytes/LICENSE.txt
Luhn10 algorithm

Implementation of the Luhn 10 algorithm to check validity of credit card numbers. See http://en.wikipedia.org/wiki/Luhn_algorithm for details on the algorithm.

var validCreditCard = function(a,b,c,d,e){for(d=+a[b=a.length-1],e=0;b--;)c=+a[b],d+=++e%2?2*c%10+(c>4):c;return!(d%10)};

validCreditCard('378282246310005'); //=> true
validCreditCard('378282246310006'); //=> false

// some numbers to test with
// 378282246310005 371449635398431 378734493671000
@madrobby
madrobby / LICENSE.txt
Created May 18, 2011 13:50 — forked from 140bytes/LICENSE.txt
Credit card detection
Copyright (c) 2011 Thomas Fuchs, http://mir.aculo.us/
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
@madrobby
madrobby / annotated.js
Created May 17, 2011 12:44 — forked from 140bytes/LICENSE.txt
Unit testing
function(
a, // a object holding test functions
b, // a logging function, taking multiple arguments
c, // placeholder
d, // placeholder
e, // placeholder
f // placeholder
){
c = d = e = 0; // initialize asserts, failures and exception counts to 0
for ( // iterate