This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var window:Object = {}; | |
new function():void { | |
var shared:Number = 100; | |
/** | |
*/ | |
function Foo():void { | |
this.getNumber = function():Number { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function toConstantCase() { | |
var a = arguments; | |
if( a.length == 1 ) { | |
return a[0].replace( toConstantCase.REGEX, toConstantCase ).toUpperCase(); | |
} | |
return a[0][0] + "_" + a[0][1] + ( a[0][2] ? a[0][2] : "" ); | |
} | |
toConstantCase.REGEX = /[a-z][A-Z]|[A-Z]{2}[a-z]/g; | |
// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Class() { | |
} | |
Class.prototype = new function() { | |
var value = 100; | |
function getValue() { | |
return value++; | |
} | |
this.getValue = getValue; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if( /MSIE [6-8]\./.test(navigator.userAgent) ) { | |
// These elements will be treated like <span> elements by MSIE, | |
// but you can use CSS to style them like any other element. | |
var elements = [ | |
"article", | |
"aside", | |
"footer", | |
"header", | |
"nav", | |
"section" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This function SHOULD be called directly by an event listener (see example). | |
// Works in Chrome, Firefox, MSIE, Opera and Safari. | |
window.getEvent = function() { | |
var event = getEvent.caller.arguments[0]; | |
return event ? event : window.event; | |
} | |
// | |
// Example | |
// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
o = document.createElement( "audio" ); | |
if( o.canPlayType ) { | |
audioAvailable = o.canPlayType( 'audio/mp4; codecs="mp4a"' ) == "probably"; | |
} | |
o = document.createElement( "video" ); | |
if( o.canPlayType ) { | |
videoAvailable = o.canPlayType( 'video/mp4; codecs="avc1,mp4a"' ) == "probably"; | |
} | |
// NOTE: The codecs must be double-quoted |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this is part of my core javascript code, it detects flash and MP4 media playback capabilities | |
window.core = new function() { | |
var document = window.document; | |
var navigator = window.navigator; | |
var flashVersion = null; | |
var flashAvailable = false; | |
var audioAvailable = false; // MP4 | |
var videoAvailable = false; // MP4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.cast = function( o ) { | |
return Array.prototype.slice.call( o, o ); | |
} | |
// | |
// EXAMPLES | |
// | |
function foo() { | |
// arguments to array |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package { | |
import com.adobe.utils.AGALMiniAssembler; | |
import flash.display.Bitmap; | |
import flash.display.Loader; | |
import flash.display.MovieClip; | |
import flash.display.Sprite; | |
import flash.display.StageAlign; | |
import flash.display.StageQuality; | |
import flash.display.StageScaleMode; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var o; | |
var v; | |
var x = /([0-9]+).([0-9]+).[\w]?([0-9]+)/; | |
try { | |
o = navigator.plugins["Shockwave Flash"]; | |
v = o.description.match( x ); | |
} | |
catch( error ) { | |
try { | |
o = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); |