Skip to content

Instantly share code, notes, and snippets.

View jcasimir's full-sized avatar

Jeff Casimir jcasimir

View GitHub Profile
<%= link_to "/tickets/#{@market.name.downcase}/ticket/#{category.slug}", nil, :class => "some class" do %>
HTML GARBAGE
<% end %>
@jcasimir
jcasimir / gist:3190890
Created July 27, 2012 22:48 — forked from stevenbristol/gist:3188943
overriding DecoratedEnumerableProxy
class InvoicesController < ApplicationController
def index
respond_with id InvoicesDecorator.new(invoices, InvoiceDecorator)
end
end
class InvoicesDecorator < Draper::DecoratedEnumerableProxy
def method_regardless_of_invoices_empty_or_not
"yay"
@jcasimir
jcasimir / exporter.rb
Created February 26, 2012 20:09 — forked from chad/exporter.rb
Export ActiveRecord Tables to CSV
require 'csv'
module Exporter
DEFAULT_EXPORT_TABLES = [ Invoice, InvoiceItem, Item, Merchant, Transaction, User ]
DESTINATION_FOLDER = "tmp/"
def self.included(klass)
klass.extend ClassLevelMethods
end
@jcasimir
jcasimir / shopping_game.rb
Created December 29, 2011 03:31 — forked from eliseworthy/shopping_game.rb
Shopping game
def get_move(message)
puts message
prompt # What does this method do?
gets.chomp.downcase
end
def department_stores
message = "You kept walking ahead. There are two department stores in front of you." +
"Do you want to go to WALMART or Nordstroms?"
while true
require "rubygems"
require "fastercsv"
class SalAttend
attr_accessor :file
attr_accessor :headers
# Added the parameter here...
def initialize(filename)
puts "JSAttend Initialized"
<h1><%= pluralize @articles.count, "Article" %></h1>
<%= link_to "Add", new_article_path, :class => "new_article" %>
<ul id="articles">
<% @articles.each do |article| %>
<li><%= link_to article.title, article_path(article) %></li>
<% end %>
</ul>
begin
beer = 3
while beer > 1
# Repeat what's in here as long as it's TRUE that the counter is greater than zero
puts "#{beer} bottles of beer on the wall, #{beer} bottles of beer! Take one down and pass it around,"
beer = beer - 1
if beer > 1
puts "#{beer} bottles of beer on the wall."
else
puts "#{beer} bottle of beer on the wall."
@jcasimir
jcasimir / toc.rb
Created April 18, 2011 22:40 — forked from racbarn/toc.rb
line_width = 25
begin
puts 'Table of Contents'.center(line_width)
puts 'Chapter 1: Intro'.ljust(line_width) + 'page 1'.rjust(line_width)
puts 'Chapter 2: Numbers'.ljust(line_width) + 'page 9'.rjust(line_width)
puts 'Chapter 3: Letters'.ljust(line_width) + 'page 13'.rjust(line_width)
end
require 'rubygems'
require 'jumpstart_auth'
class JSTwitter
attr_reader :client
def initialize
puts "Initializing"
@client = JumpstartAuth.twitter
end
require 'rubygems'
require 'jumpstart_auth'
class JSTwitter
attr_reader :client
def initialize
puts "Initializing"
@client = JumpstartAuth.twitter
end