Skip to content

Instantly share code, notes, and snippets.

View tdouce's full-sized avatar

Travis Douce tdouce

View GitHub Profile
@tdouce
tdouce / amware_javascript_warnings - final #2
Created September 22, 2011 02:23
amware_javascript_warnings - final #2
$(".commit").click( function(e){
var warning = '<p class="inline-errors"> Warning, this is blank </p>'
var all_selections = [];
var not_filled_out = [];
var index_counter = 0;
$( '.check_value' ).children().each( function(){
var li = $(this);
@tdouce
tdouce / amware_javascript_warnings - final #1
Created September 22, 2011 02:22
amware_javascript_warnings - final #1
$(".commit").click( function(e){
var warning = '<p class="inline-errors"> Warning, this is blank </p>'
var all_selections = [];
var not_filled_out = [];
$( '.check_value' ).children().each( function(){
var li = $(this);
var li_value = li.val();
@tdouce
tdouce / amware_try_shorter
Created September 21, 2011 20:49
amware_try_shorter
$(".commit").click( function(e){
alert('working');
var warning = '<p class="inline-errors"> Warning, this is blank </p>'
var all_selections = [];
var not_filled_out = [];
@tdouce
tdouce / amware_javascript_warnings
Created September 20, 2011 01:52
Amware javascript warnings
// Finds what datetime selections have and have not been filled out
// Also finds all the datetime selections that was passed in the array
function find_max_filled_out( check_arrays )
{
var filled_out = [];
var not_filled_out = [];
var all_selections = [];
for ( check in check_arrays )
{
@tdouce
tdouce / gist:1223364
Created September 16, 2011 22:55
Form validation to check if preceding datetime selects are filled out
// Finds what datetime selections have and have not been filled out
// Also finds all the datetime selections that was passed in the array
function find_max_filled_out( check_arrays )
{
var filled_out = [];
var not_filled_out = [];
var all_selections = [];
for ( check in check_arrays )
{
@tdouce
tdouce / .gitignore
Created August 30, 2011 19:03
.gitignore
*.*~
.gitignore
.gitignore~
<p> Appointment Time: ____<%= l(receipt.try( :appointment_at ), :format => :long) %> ______ </p>
ActiveAdmin.register Customer do
index do
column :name
column :customer_number
column :warehouse_id do |warehouse|
warehouse.name
end
column :warehouse_id
default_actions
end
Factory.define :customer do |f|
f.customer_number "MyString"
f.name "MyString"
f.association :warehouse
end
Factory.define :door do |f|
f.name "MyString"
f.association :warehouse
end
@tdouce
tdouce / receipt.rb
Created July 16, 2011 10:41
amware
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
ROLES = [ :Administrator, :User ]
validates :role, :presence => true
validates :username, :presence => true
validates :username, :uniqueness => true
validates :employee_name, :presence => true
validates :encrypted_password, :presence => true
has_many :receipts