This file contains 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
/** | |
* Add items to Array in a sorted order. | |
* @param {Array} arr | |
* @param {Number} item | |
* @author Miller Medeiros | |
* Released under the WTFPL (http://sam.zoy.org/wtfpl/) | |
*/ | |
function sortedInsert(arr, item){ | |
var n = arr.length; | |
do { n--; } while (item < arr[n]); |
This file contains 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
/*jslint onevar:true, undef:true, newcap:true, regexp:true, bitwise:true, maxerr:50, indent:4, white:false, nomen:false, plusplus:false */ | |
/*!! | |
* JS Signals <http://millermedeiros.github.com/js-signals/> | |
* Released under the MIT license <http://www.opensource.org/licenses/mit-license.php> | |
* @author Miller Medeiros <http://millermedeiros.com/> | |
* @version 0.5.3 | |
* @build 143 (02/21/2011 07:18 PM) | |
*/ | |
var signals = (function(){ |
This file contains 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
// | |
// Orthodox Chaining | |
// | |
//basic Object that implements chaining | |
var myObj = { | |
_val : 'lorem', | |
val : function(val){ | |
if(val === void(0)){ | |
return this._val; |
This file contains 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
/*! | |
* RequireJS plugin for async dependency load like JSONP and Google Maps | |
* @author Miller Medeiros | |
* @version 0.0.1 (2011/03/23) | |
* Released under the MIT License <http://www.opensource.org/licenses/mit-license.php> | |
*/ | |
define(function(){ | |
function injectScript(src){ | |
var s, t; |
This file contains 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
/* | |
* Example how to preload HTML5 video on the iPad (iOS 3.2+) | |
* @author Miller Medeiros | |
* Released under WTFPL | |
*/ | |
var vid = document.createElement('video'); | |
vid.src = 'lol_catz.mp4'; | |
document.getElementById('video-holder').appendChild(vid); |
This file contains 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
Copyright (c) 2011 Jed Schmidt, http://jed.is | |
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: | |
This file contains 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
//set location of "noext!" plugin | |
//(this setting should be on the top-level of your app, inside your "main.js" or HTML file) | |
//you could also omit this setting and just place the "ext.js" file in the `baseUrl` folder. | |
require({ | |
paths : { | |
noext : 'path_to_plugin/noext' | |
} | |
}); | |
//load file without appending ".js" extension |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>example crossroads + hasher</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
</head> | |
<body> | |
<div id="wrapper"> | |
<ul> |
This file contains 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
// ----------------------- | |
// refactor by Miller Medeiros (http://blog.millermedeiros.com) | |
// of code samples present on position-absolute.com blog post: | |
// http://www.position-absolute.com/articles/organizing-events-with-jquery/ | |
// ----------------------- | |
//just so we make sure `myApp` does exist | |
window.myApp = window.myApp || {}; |
This file contains 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
//create our "FOO" namespace | |
window.FOO = window.FOO || {}; | |
FOO.app1 = { | |
bar : 'foo', | |
init : function(){ | |
//this wont work as expected since timeout changes scope |