Skip to content

Instantly share code, notes, and snippets.

View tenpaiyomi's full-sized avatar

Eric Musgrove tenpaiyomi

View GitHub Profile
@tenpaiyomi
tenpaiyomi / concept-graph.js
Last active February 5, 2016 04:23 — forked from kanesee/concept-graph.js
d3 2-way tree
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()
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
<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.
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
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
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)