This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var CollapsibleTree = function(elt) { | |
var m = [20, 120, 20, 120], | |
w = 1280 - m[1] - m[3], | |
h = 580 - m[0] - m[2], | |
i = 0, | |
root, | |
root2; | |
var tree = d3.layout.tree() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyAwesomeController < ApplicationController | |
def new | |
@user_session = UserSession.new | |
end | |
def create | |
@user_session = UserSession.new(params[:user_session]) | |
if @user_session.save | |
flash[:notice] = "Logged in" | |
redirect_to root_url |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<td height="135" width="135" valign="top" align="center"> | |
<p> | |
<%= current_image(product) %><br/> | |
<%= link_to current.name, :controller => :products, :action => 'show', :id => Product.create_old_name(current.name) %> | |
</p> | |
</td> | |
# Ok, the Product.create_old_name is retarded...I didn't know much about helpers then, but it should have been in a helper. | |
# Create a helper called 'def create_old_name(name)' and have it do the processing and return the correct output. | |
# I think you can probably put it in application controller and have both products and categories call it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
desc "Reestablish category/product associations." | |
task :move_products_to_categories => :environment do | |
#get products | |
#add product to its category via parent_id | |
#save | |
products = Product.find(:all, :conditions => "parent_id IS NOT null") | |
products.each do |product| | |
puts "Product is: #{product.name}" | |
# unless / else statements are just bad form |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Customer < ActiveRecord::Base | |
def self.columns() @columns ||= []; end | |
def self.column(name, sql_type = nil, default = nil, null = true) | |
columns << ActiveRecord::ConnectionAdapters::Column.new(name.to_s, default, default, sql_type.to_s, null) | |
end | |
column :contact_name_billing, :string | |
column :email_billing, :string | |
column :address1_billing, :string | |
column :address2_billing, :string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MenuBarController | |
def init | |
if super | |
# Create our status bar for the application | |
puts "Initializing....." | |
# menuZone = NSMenu.menuZone() | |
# menu = NSMenu.allocWithZone(menuZone) | |
menuItem = NSStatusBar.systemStatusBar.statusItemWithLength(NSVariableStatusItemLength) | |