Skip to content

Instantly share code, notes, and snippets.

View thedelchop's full-sized avatar

Joseph DelCioppio thedelchop

View GitHub Profile
@thedelchop
thedelchop / css-counter.scss
Created May 8, 2012 01:27
Using counters inside CSS
form {
counter-reset: form-number;
.control-group {
&:before{
@include border-radius(20px);
content: counter(form-number);
counter-increment: form-number;
@thedelchop
thedelchop / payable_decorator.rb
Created April 20, 2012 18:39
Basically and integration test
PayableDecorator < ApplicationDecorator
decorates :payable
def due_date_in_words
if payable.due_date > Date.today
"#{due_date} (#{h.distance_of_time_in_words(payable.due_date, Date.today)} from now)"
elsif payable.due_date < Date.today
"#{due_date} (#{h.distance_of_time_in_words(payable.due_date, Date.today)} ago)"
else
"#{due_date} (today)"
@thedelchop
thedelchop / omniauth_callbacks_controller.rb
Created February 28, 2012 18:18
Callback for Harvest
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
def harvest
# You need to implement the method below in your model
current_user.update_attributes(:harvest_token = request.env["omniauth.auth"][WHERE EVER THE TOKEN IS IN THE HASH HARVEST RETURNS]
redirect_to WHERE YOU WANT TO GO
end
end
<div class="content"><p>ZOMG I SUCK AT WRITING MARKUP</p><a href="http://wwww.cantwritemarkup.com">See the above</a></br><div><ul><li>You can see how this gets hard to read</li><li>This is the problem HAML trys to solve</li></ul></div>
@thedelchop
thedelchop / news.rb
Created August 30, 2011 21:55
Unorganized code
class News < ActiveRecord::Base
acts_as_commentable
cattr_reader :per_page
@@per_page = 7
belongs_to :user
has_many :posts, :as => :posting, :dependent => :destroy
has_attached_file :image,
:styles => {
@thedelchop
thedelchop / .autotest
Created July 30, 2011 23:56
Autotest configuration to run a specified file
Autotest.add_discovery { "rails" }
Autotest.add_discovery { "rspec2" }
Autotest.add_hook :initialize do |at|
if ARGV.empty?
%w{.git test vendor rerun.txt tmp public/system sqlite3 log/development.log log/production.log log/test.log log/server.log}.each {|exception| at.add_exception(exception)}
else
at.find_directories = ARGV.dup
end
end
@thedelchop
thedelchop / autotest bash
Created June 29, 2011 13:05
Bash command
autotest app/models spec/models
@thedelchop
thedelchop / .autotest.rb
Created June 29, 2011 13:03
Autotest setup
Autotest.add_hook :initialize do |at|
if ARGV.empty?
%w{.git test vendor rerun.txt tmp public/system sqlite3 log/development.log log/production.log log/test.log log/server.log}.each {|exception| at.add_exception(exception)}
else
at.find_directories = ARGV.dup
end
end
@thedelchop
thedelchop / export
Created May 20, 2011 18:57
Output of export
declare -x Apple_PubSub_Socket_Render="/tmp/launch-DW5Sty/Render"
declare -x COLORFGBG="7;0"
declare -x COMMAND_MODE="unix2003"
declare -x COM_GOOGLE_CHROME_FRAMEWORK_SERVICE_PROCESS/USERS/THEDELCHOP/LIBRARY/APPLICATION_SUPPORT/GOOGLE/CHROME_SOCKET="/tmp/launch-Utvq76/ServiceProcessSocket"
declare -x DESTINATION="/var/folders/H5/H561aN6KFOCKYXIrl-0bgU+++TI/-Tmp-/Alfred 107 Update"
declare -x DISPLAY="/tmp/launch-icmj7T/org.x:0"
declare -x DYLD_LIBRARY_PATH="/usr/local/mysql/lib:"
declare -x GEM_HOME="/Users/thedelchop/.rvm/gems/ruby-1.9.2-p180"
declare -x GEM_PATH="/Users/thedelchop/.rvm/gems/ruby-1.9.2-p180:/Users/thedelchop/.rvm/gems/ruby-1.9.2-p180@global"
declare -x GREP_OPTIONS="--color"
Using the default profile...
...Member
SELECT "events".* FROM "events" WHERE "events"."event_type" = 'second' AND ("events"."member_id" = 1298)
Motion
SELECT "events".* FROM "events" WHERE "events"."event_type" = 'second' AND ("events"."member_id" = 1298) AND ("events"."motion_id" = 788)
...Member
SELECT "events".* FROM "events" WHERE "events"."event_type" = 'second' AND ("events"."member_id" = 1296)
.Member
SELECT "events".* FROM "events" WHERE "events"."event_type" = 'second' AND ("events"."member_id" = 1296)
Motion