Skip to content

Instantly share code, notes, and snippets.

Alex Sexton SlexAxton

Block or report user

Report or block SlexAxton

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:362179
// 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.
SlexAxton / Yepnope Recursion in Callbacks.js
Created Nov 22, 2010
Trying to add access to the api inside of callbacks
View Yepnope Recursion in Callbacks.js
* Yepnope JS
* Version 0.2.6pre
* by Alex Sexton -
* Tri-Licensed WTFPL, BSD, & MIT
(function(window, doc, undef) {
View Usage of new yepnope callback style.js
// Call yepnope
load: '',
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 / testswarmngingx.conf
Created Dec 2, 2010
a nginx conf for the testswarm .htaccess
View testswarmngingx.conf
location ~ \.ini$ { deny all; }
location / {
root /;
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;
SlexAxton / load structure.js
Created Dec 16, 2010
not working code, just the general idea
View load structure.js
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 /
Created Feb 24, 2011
yepnope.js compress script
node build/UglifyJS/bin/uglifyjs --extra --unsafe yepnope.js > yepnope.min.js
m=$(ls -la yepnope.min.js | awk '{ print $5}')
gzip -nfc --best yepnope.min.js > yepnope.min.js.gz
g=$(ls -la yepnope.min.js.gz | awk '{ print $5}')
echo "$m bytes minified, $g bytes gzipped"
rm yepnope.min.js.gz
if [ "--test" == "$1" ]; then
rm yepnope.min.js
SlexAxton / yepnopehelper.js
Created Mar 15, 2011
How you might avoid loading jQuery twice (until it's a prefix)
View yepnopehelper.js
// If you always need jQuery regardless
load: 'jquery.js'
test: Modernizr.something,
nope: 's1.js',
complete: function () {
SlexAxton / once-filter.js
Created Mar 15, 2011
For yepnope. don't reexecute dupes.
View once-filter.js
* Yepnope Once Filter
* by Alex Sexton
* Run this (ideally concatenated into the yepnope minified file) and any script that
* you try to include twice will automatically be skipped (but your callback will still run).
SlexAxton / cfinstall.1.0.3mod-min.js
Created Aug 10, 2011
Chrome Frame install script with 'user=true' as a config value option (no admin needed)
View cfinstall.1.0.3mod-min.js
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
(function(d){if(!d.CFInstall){var e=function(a){return typeof a=="string"?document.getElementById(a):a},f=function(){if(d.a.b)return d.a.c;if(navigator.userAgent.toLowerCase().indexOf("chromeframe")>=0)return!0;if(typeof window.ActiveXObject!="undefined")try{var a=new ActiveXObject("ChromeTab.ChromeFrame");if(a)return a.k(),!0}catch(b){}return!1},g=function(a){try{var b=document.createElement("style");b.setAttribute("type","text/css");b.styleSheet?b.styleSheet.cssText=a:b.appendChild(document.createTextNode(a));
var c=document.getElementsByTagName("head")[0];c.insertBefore(b,c.firstChild)}catch(d){}},h=!1,i=!1,j=function(){if(!i)g(".chromeFrameOverlayContent { display: none; }.chromeFrameOverlayUnderlay { display: none; }"),document.cookie="disableGCFCheck=1;path=/;max-age=31536000000",i=!0},k=function(a){var b=document.createElement("iframe")
SlexAxton /
Created Aug 16, 2011
Install better vim
brew install --with-features=huge --enable-interp=ruby,mzscheme,python
You can’t perform that action at this time.