Public Gists by mattpolito

Gravatar
Mon Aug 31 18:50:57 -0700 2009
1
2
3
# Delete unnecessary files
run "rm public/index.html"
run "rm public/favicon.ico"
Gravatar
Mon Aug 31 07:15:15 -0700 2009
1
2
3
#!/usr/bin/env ruby
puts "looking for the gems to upgrade..."
gem_info = Struct.new(:name, :version)
Gravatar
Tue Aug 11 11:12:10 -0700 2009
1
2
3
// only outputs if console available and does each argument on its own line
function log() {
  if (window && window.console && window.console.log) {
Gravatar
Sat Jul 25 12:22:36 -0700 2009
1
2
3
# download, from_repo, and commit_state methods swiped from
# http://github.com/Sutto/rails-template/blob/07b044072f3fb0b40aea27b713ca61515250f5ec/rails_template.rb
 
Gravatar
Wed Jul 22 08:25:19 -0700 2009
1
2
3
desc 'Print out all defined routes in match order, with names. Target specific controller with CONTROLLER=x.'
task :routes => :environment do
  all_routes = ENV['CONTROLLER'] ? ActionController::Routing::Routes.routes.select { |route| route.defaults[:controller] == ENV['CONTROLLER'] } : ActionController::Routing::Routes.routes
Gravatar
Wed Jul 15 06:14:42 -0700 2009
1
2
3
# download and git methods swiped from http://github.com/Sutto/rails-template/blob/07b044072f3fb0b40aea27b713ca61515250f5ec/rails_template.rb
 
require 'open-uri'
Gravatar
Tue Jul 14 09:55:06 -0700 2009
1
2
3
(function($) {
  // errors is an array of errors
  // render :json => {:errors => @item.errors.full_messages}
Gravatar
Tue Jul 07 09:56:07 -0700 2009
1
2
3
HOWTO: iPhone AT&T Tethering
============================
 
Gravatar
Fri Jun 12 07:21:01 -0700 2009
1
2
3
# using machinist and Authlogic to crat
 
def login!(options = {})
Gravatar
Thu May 28 08:49:20 -0700 2009
1
2
3
  validate :uniqueness_of_login_by_store_front, :unless => :skip_uniqueness_of_login_by_store_front?
  validates_format_of :email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i
  attr_accessor :password_confirmation
Gravatar
Fri May 01 18:13:32 -0700 2009
1
2
3
# When a spammer wants to attack your site, they'll likely send an automated bot
# that will blindly fill out any forms it encounters. The idea of a "honeypot" is that
# you place a hidden field in a form. That's the honeypot. If this field is filled in, then
Gravatar
Wed Apr 08 13:38:04 -0700 2009
1
2
3
# Patch Paperclip reprocess! and to_file methods to use binary mode (for Windows compatibility)
# Fixup content type on assignment
# Ensure the :original style is always processed first
Gravatar
Wed Apr 08 13:37:32 -0700 2009
1
2
3
class ImageModelsController < ApplicationController
  before_filter :find_image_model, :only => [:update]
 
Gravatar
Wed Mar 25 07:47:22 -0700 2009
1
2
3
# Patch Paperclip reprocess! and to_file methods to use binary mode (for Windows compatibility)
# Fixup content type on assignment
# Ensure the :original style is always processed first
Gravatar
Mon Mar 09 05:37:32 -0700 2009
1
2
3
# 1. Create dirs for unpacking your source code and installing your apps
mkdir $HOME/src
mkdir $HOME/apps
Gravatar
Fri Feb 27 14:07:00 -0800 2009
1
2
3
# load rubygems, wirble and utility_belt
require 'rubygems'
require 'wirble'
Gravatar
Wed Feb 25 11:00:55 -0800 2009
1
2
3
When new line link is pressed, I get a new line to appear in my table... but the attributes for the new line are always the same as the first (invoice[line_attributes][new_1])
 
What am I missing?
Gravatar
Mon Jan 26 13:35:09 -0800 2009
1
2
3
# App Template
# By Matt Polito
 
Gravatar
Thu Jan 22 13:25:08 -0800 2009
1
2
3
def new
  @product_request = ProductRequest.new
  @ps = ProductSpecification.find(params[:spec])
Gravatar
Sun Jan 18 21:51:02 -0800 2009
1
2
3
class PagesController < ApplicationController
  before_filter :login_required, :except => [ :show ]