Skip to content

Instantly share code, notes, and snippets.

View lemieuxster's full-sized avatar

David LeMieux lemieuxster

View GitHub Profile
@lemieuxster
lemieuxster / PenguinOfDoom
Last active August 29, 2015 14:07
Very Random
(function() {
var penguinOfDoom = "hi every1 im new!!!!!!! holds up spork my name is katy but u can call me t3h PeNgU1N oF d00m!!!!!!!! lol…as u can see im very random!!!! thats why i came here, 2 meet random ppl like me _… im 13 years old (im mature 4 my age tho!!) i like 2 watch invader zim w/ my girlfreind (im bi if u dont like it deal w/it) its our favorite tv show!!! bcuz its SOOOO random!!!! shes random 2 of course but i want 2 meet more random ppl =) like they say the more the merrier!!!! lol…neways i hope 2 make alot of freinds here so give me lots of commentses!!!! DOOOOOMMMM!!!!!!!!!!!!!!!! <--- me bein random again _^ hehe…toodles!!!!! love and waffles, t3h PeNgU1N oF d00m";
var regularRandom = Math.random;
window.Math.random = function() {
var num = regularRandom();
if (parseFloat(num.toFixed(4)) === 0.4242) {
num = penguinOfDoom;
}
return num;
@lemieuxster
lemieuxster / mxmlc_interface.rb
Created July 18, 2012 16:46
MXMLC Interface in Ruby
#For compiling swfs using MXMLC, tooled to fit Flite build needs.
class MXMLCInterface
MXMLC = ENV["FLEX_HOME"] ? File.join(ENV["FLEX_HOME"], "bin/mxmlx") : "./bin/mxmlc"
FLEX_CONFIG = ENV["FLEX_CONFIG"] || "./"
@@mxmlc = MXMLC
def self.mxmlc= (value)
@@mxmlc = value
end
@lemieuxster
lemieuxster / as3_annotation_parser.rb
Created July 18, 2012 16:44
AS3 Annotation Parse in ruby
# Used to parse ActionScript style annotations
# [Annotation(key="value",foo="bar")]
# Where Annotation is the name and key and foo are attribute names.
# Quick string matching, does not create an "Annotation Object"
# for now, though that would be an improvement.
class AS3AnnotationParser
#Does the given annotation exist in the provided string?
def self.has_annotation (contents, name)
contents.match(/\[#{name}[^\]]?+\]/) != nil
end
@lemieuxster
lemieuxster / Rakefile
Created July 18, 2012 16:43
Rake/Flash Build example
#!/usr/bin/env ruby
require "./mxmlc_interface"
require "./as3_annotation_parser"
BUILD_ANNOTATION_NAME = "Build"
PROJECT_DIRECTORY = "/foo"
OUTPUT_DIRECTORY = "/foo/output"
#Set up compiler settings
@lemieuxster
lemieuxster / Bookmarkified
Created May 2, 2012 18:37
QR Code Bookmarklet
javascript:(function(window, document, undefined) {try {var selectedText = document.getSelection().toString(); if (selectedText === ''){selectedText = window.location.href;} if(selectedText !== ''){var baseQRUrl = 'http://chart.apis.google.com/chart?cht=qr&chs=300x300&chl=' + encodeURIComponent(selectedText); window.open(baseQRUrl, '_blank', 'width=400,height=400');}} catch (e) {}})(window, document);
@lemieuxster
lemieuxster / JavaScriptMandlebrot
Created April 27, 2011 16:15
JavaScript Mandlebrot ASCII Art
/* Ported from Java which was ported from Python. I can't recall the original author */
function generateMandlebrot() {
var b,e,r,n,d,h,out="";
for(e=1.1;e>-1.2;e-=.1)for(b=-2;b<1;b+=.04,out+=(String.fromCharCode(b>1?10:h)))
for(r=n=0,h=127;r*r+n*n<4&&--h>32;d=r,r=r*r-n*n+b,n=2*d*n+e);
return out;
}