Skip to content

Instantly share code, notes, and snippets.

View shaneriley's full-sized avatar

Shane Riley shaneriley

View GitHub Profile
class WireframesController < ActionController::Base
public_pages = [:sign_in, :confirm_registration, :homepage, :register, :business_admin_layout]
survey_pages = [:survey_1, :survey_2, :survey_3]
before_filter :admin_layout, :except => public_pages + survey_pages
before_filter :public_layout, :only => public_pages, :except => :business_admin_layout
before_filter :survey_layout, :only => survey_pages
def admin_layout
render :layout => "nuguava_admin"
end
$("a[data-method='delete']").live("click.delete", function() {
var $e = $(this);
if ($e.attr("data-confirm")) {
if (!confirm($e.attr("data-confirm"))) {
return false;
}
}
var $form = $("<form />");
$("<input />").attr({
type: "hidden",
var isIphone = (function() {
return navigator.userAgent.match(/iPhone|iPod/i) != null;
})();
var isIpad = (function() {
return navigator.userAgent.match(/iPad/i) != null;
})();
var l = true,
n = null,
o = false,
p = [
["book of healing", 5],
["book of vision", 5],
["book of cure", 5],
["book of genocide", 5]
],
q = [
A B C D E F G
1 + + +
2 + + +
3 + + + + + + +
4 + + + + + +
5 + + + + + + +
6 + + +
7 + + +
@shaneriley
shaneriley / gist:895001
Created March 30, 2011 18:49
Dummy Image Helper
def dummy_image(dimensions, bg_color="cccccc", fg_color="333333")
"http://dummyimage.com/#{dimensions}/#{bg_color}/#{fg_color}"
end
[branch "master"]
remote = origin
merge = refs/heads/master
@shaneriley
shaneriley / gist:938084
Created April 23, 2011 01:12
jQuery Placeholder Attribute Polyfill
if (!("placeholder" in document.createElement("input"))) {
$("input[placeholder]").each(function() {
var $e = $(this),
placeholder = $e.attr("placeholder");
$e.val(placeholder);
$e.bind("focus blur", function(e) {
if (e.type === "focus" && $e.val() === placeholder) { $e.val(""); }
else { if (!$e.val()) { $e.val(placeholder); } }
});
}).closest("form").submit(function() {
@shaneriley
shaneriley / gist:963024
Created May 9, 2011 18:13
jQuery Toggle Attribute Plugin
$.fn.toggleAttr = function(attr) {
return this.each(function() {
var $e = $(this);
$e.attr(attr, !!!$e.attr(attr));
});
};
@shaneriley
shaneriley / gist:982086
Created May 20, 2011 00:22
Object-Oriented jQuery!!!!!1
$(function() {
var app = {
tasks: {
selector: "section > ul > li"
}
}
app.tasks.heading = {
selector: app.tasks.selector + " h2",
click: function() {
$(this).closest("li").find(".details").toggle();