Skip to content

Instantly share code, notes, and snippets.

Playing with gist
Cool?
(function($){
$.fixieAjaxForm = function(onSuccess) {
// $('form').fixieAjaxForm()
// $(this) == $('form') inside this function
$(this).ajaxForm(function(str) {
var data = $.parseJSON(str);
$(this).find('label.error').removeClass('error');
if (data.errors.length === 0) {
$(this).resetForm();
onSuccess(data);
// Outer function just allows use of $ or jQuery (for jQuery Plugins)
(function($){
// Creates a jQuery wrapper method so methods can be attached to jQuery wrapped sets eg:
// $('form').fixieAjaxForm()
$.fixieAjaxForm = function(successCallback) {
// $(this) == $('form') inside this function
$(this).ajaxForm(function(str) {
var data = $.parseJSON(str);
$(this).find('label.error').removeClass('error');
if (data.errors.length === 0) {
<div class="header_wrapper">
<div class="header clearfix">
<h1><a href="/">Kashless</a></h1>
<ul class="menu">
<li>
<%= link_to "Find a free item", listings_path %>
</li>
<li>
<%= link_to "Give Away", new_listing_path %>
.header_wrapper
.header.clearfix
%h1= link_to "Kashless", "/"
%ul.menu
%li= link_to "Find a free item", listings_path
%li= link_to "Give Away", new_listing_path
- if logged_in? && current_user.has_role?(:admin)
%li= link_to "Users Admin", admin_users_path
$(function() {
$('.checkbox input:checkbox').change(function(){
var service = $(this).parent().next().find('label:first');
if($(this).is(':checked')) {
service.addClass('active');
} else {
service.removeClass('active');
}
}).triggerHandler('change');
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="jquery.js" type="text/javascript"></script>
<script src="cufon-yui.js" type="text/javascript"></script>
<script src="archer-medium.font.js" type="text/javascript"></script>
<script src="archer-semibold.font.js" type="text/javascript"></script>
<script src="archer-bold.font.js" type="text/javascript"></script>
===VIEW===
<%- form_for @credential, user_external_credentials_path(@user), :class => "horizontal" do -%>
<div class="input-wrapper">
<%= f.label :login, "Twitter Username" -%>
<%= f.text_field :login, :class => 'text' -%>
</div>
<div class="input-wrapper">
<%= f.label :password, "Twitter Password" -%>
module Ramaze
module Helper
module Grid
LOOKUP << self
def grid_unit options={}, &block
haml_tag :div, {:id => options[:id], :class => "yui-u#{ ' first' if options[:first] }"} do
block.call
end
end
end
/* ============================= */
/* = Based off of the 1Kb Grid = */
/* ============================= */
!column_width = 30
!column_gutter = 10
!number_of_columns = 24
=push(!columns)
margin-left = (!column_width * !columns) + (!column_gutter * (!columns - 1)) + "px"