Skip to content

Instantly share code, notes, and snippets.

View mstudio's full-sized avatar

Alex Motzenbecker mstudio

View GitHub Profile
@mstudio
mstudio / isCreditCard
Created March 8, 2012 19:18
Exercise 4
function isCreditCard(CC) {
if (CC.length > 19)
return (false);
var sum = 0; var mul = 1; var l = CC.length; var digit; var tproduct;
for (var i = 0; i < l; i++) {
digit = CC.substring(l - i - 1, l - i);
@mstudio
mstudio / clear-canvas.js
Created February 14, 2012 21:13
HTML5 clear canvas
// this:
context.clearRect(0, 0, width, height);
// or:
canvas.width = canvas.width;
@mstudio
mstudio / copy.as
Created November 29, 2011 21:49
AS3: Copy display Object
public static function copy(d:DisplayObject, w:Number, h:Number, smoothing : Boolean = true): Bitmap
{
var data:BitmapData = new BitmapData(w, h, true, 0xffffff);
var bmp:Bitmap = new Bitmap(data);
bmp.smoothing = smoothing;
bmp.bitmapData.draw(d);
return bmp;
}