Skip to content

Instantly share code, notes, and snippets.

View SlexAxton's full-sized avatar

Alex Sexton SlexAxton

View GitHub Profile
@SlexAxton
SlexAxton / load structure.js
Created December 16, 2010 19:45
not working code, just the general idea
function preload(url, loadedCb) {
var tagType = 'img' || 'object',
elem = document.createElement(elem),
correctCallback = 'onerror' || 'onload';
if (tagType === 'img') {
elem.width = '1';
elem.height = '1';
}
@SlexAxton
SlexAxton / testswarmngingx.conf
Created December 2, 2010 08:26
a nginx conf for the testswarm .htaccess
location ~ \.ini$ { deny all; }
location / {
root /location.com/httpdocs;
index index.php index.html index.htm;
try_files $uri $uri/index.php @normal; location @normal { redirects }
rewrite ^(.*[^/])$ $1/ permanent;
rewrite ^run/$ index.php?state=run last;
rewrite ^run/(.*)/?$ index.php?state=run&user=$1 last;
// Call yepnope
yepnope([
{
load: 'http://cdn.com/jquery.js',
wait: true, // unnecessary, but clear...
callback: function(name, i, yepnope, result) {
// you have to return the execution of yepnope for this to work
return yepnope({
test: typeof window.jQuery == 'function',
nope: 'wait!local/jquery.js'
@SlexAxton
SlexAxton / Yepnope Recursion in Callbacks.js
Created November 22, 2010 23:41
Trying to add access to the api inside of callbacks
/**
* Yepnope JS
*
* Version 0.2.6pre
*
* by Alex Sexton - AlexSexton@gmail.com
*
* Tri-Licensed WTFPL, BSD, & MIT
*/
(function(window, doc, undef) {
// everyone's new favorite closure pattern:
(function(window,document,undefined){ ... })(this,this.document);
// when minified:
(function(w,d,u){ ... })(this,this.document);
// which means all uses of window/document/undefined inside the closure
// will be single-lettered, so big gains in minification.
// it also will speed up scope chain traversal a tiny tiny little bit.