Skip to content

Instantly share code, notes, and snippets.

View adamesque's full-sized avatar

Adam Luikart adamesque

View GitHub Profile
@adamesque
adamesque / preloader.js
Created February 16, 2011 23:38
Uses jQuery's new Deferred object to help with image loading
/**
* Helper function for passing arrays of promises to $.when
*/
jQuery.whenArray = function ( array ) {
return jQuery.when.apply( this, array );
};
/**
* Accepts a single image src or an array of image srcs.
@adamesque
adamesque / Rakefile
Created January 14, 2011 20:01
Custom nanoc Rakefile
require 'nanoc3/tasks'
require 'rubygems'
def rebuild_site(relative)
begin
puts ">>> Change Detected to: #{relative} >> Update Complete "
sh 'nanoc co'
rescue StandardError => e
puts e
end
@adamesque
adamesque / raphael.html
Created November 3, 2010 20:23
Modified raphael.js to allow fill image rotation
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="raphael.js"></script>
<style>
div {
/* border: 1px solid #ccc;*/
}
</style>
</head>
var placeholders = function () {
var body = $(document.body),
inputs = $("label.ui_placeholder").map(function () {
var label = $(this),
input = $("#" + label.attr("for"));
if (input.val()) {
label.hide();
}
(function () {
var selector = window.prompt("Enter a selector to highlight", "a, .gl, a span"),
els = document.querySelectorAll(selector),
el;
for each (el in els) {
if (el.style) el.style.backgroundColor = "rgba(255,0,0,0.5)";
}
}());