Skip to content

Instantly share code, notes, and snippets.

// Global reset rules.
// For more specific resets, use the reset mixins provided below
=global-reset
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
# Download all images from a stock exchange lightbox
require 'rubygems'
require 'mechanize'
require 'logger'
agent = Mechanize.new { |a| a.log = Logger.new("mech.log") }
agent.user_agent_alias = 'Mac Safari'
page = agent.get("http://www.sxc.hu/")
@items = MyModel.all
@columns = MyModel.column_names
respond_to do |format|
format.csv do
my_csv = FasterCSV.generate do |csv|
# header row
csv << @columns
# data rows
*** LOCAL GEMS ***
abstract (1.0.0)
actionmailer (3.1.0.rc1, 3.0.7, 3.0.7.rc2)
actionpack (3.1.0.rc1, 3.0.7, 3.0.7.rc2)
activemodel (3.1.0.rc1, 3.0.7, 3.0.7.rc2)
activerecord (3.1.0.rc1, 3.0.7, 3.0.7.rc2)
activeresource (3.1.0.rc1, 3.0.7, 3.0.7.rc2)
activesupport (3.1.0.rc1, 3.0.7, 3.0.7.rc2)
ansi (1.2.5)
@noel
noel / .js
Created May 30, 2011 20:30
how is this done in .coffee
$('#user_button').toggle(function () {
$("#user_button").css({borderBottomLeftRadius: "0px"});
}, function () {
$("#user_button").css({borderBottomLeftRadius: "5px"});
});
@noel
noel / gist:1057407
Created June 30, 2011 22:13
factory.rb
require 'factory_girl'
Factory.define :role do |r|
r.name 'SuperAdmin'
end
Factory.define :user do |u|
u.username "gomezn"
u.association :roles, :factory => :role
end
require 'spec_helper'
describe User do
let(:user) do
Factory(:user, :username=>"gomezn")
end
let(:role) do
Factory(:role)
Failures:
1) User should not allow for multiple users with the same username
Failure/Error: Factory(:user, :username=>"gomezn")
ActiveRecord::RecordInvalid:
Validation failed: Name has already been taken
# ./spec/models/user_spec.rb:6
# ./spec/models/user_spec.rb:35
2) User should have ldap
@noel
noel / table.html.erb
Created January 27, 2012 01:38
Dynamic Table
<table id="roles">
<thead>
<tr>
<% @columns.each do |column| %>
<th class="center"><%= column %></th>
<% end %>
</tr>
</thead>
<tbody>
<% @Roles.each_with_index do |role, index| %>
@noel
noel / gist:1692440
Created January 28, 2012 03:33
kete rake error
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /Users/noel/apps/kete/config/../vendor/rails/railties/lib/rails/gem_dependency.rb:21.
NOTE: Gem::SourceIndex#refresh! is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#refresh! called from /Users/noel/apps/kete/config/../vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:34.
NOTE: Gem::SourceIndex#load_gems_in is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#load_gems_in called from /Users/noel/.rvm/rubies/ruby-1.8.7-p357/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:322.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /Users/noel/.rvm/rubies/ruby-1.8.7-p357/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add