Skip to content

Instantly share code, notes, and snippets.

View meesterdude's full-sized avatar
🎯
Building something cool

Russell meesterdude

🎯
Building something cool
View GitHub Profile
class StoreController < ApplicationController
before_filter :check_store_status, :except => :store_closed
before_filter :find_cart, :except => :store_closed
before_filter :confirm_cart_not_empty, :only => [:display_cart, :checkout, :confirm_order, :save_order]
layout 'store'
def checkout
unless @cart.all_items_purchasable?
@meesterdude
meesterdude / whattolearn.markdown
Created May 15, 2012 19:45
Stay curious, learn anything.

There's been some buzz around jeff atwoods Please Don't Learn to Code and i'd like to chip in my two cents:

fuck anyone who tells you that you should not learn something.

I once worked for a guy who always said "I'm not a programmer" and his code showed it. Does that mean he was performing at his peak? no. He was just boxing himself in. It was an excuse to be sloppy. Anyone can be sloppy. A key difference between him and I, was giving a damn.

Don't put yourself in a box, and say "I'm not a programmer" or "I'm just a receptionist" or what have you. You can be more than one thing, with varying levels of skill set. And you can get better. You may be REALLY great at one, and suck at another. Or be generally mediocre. But you can usually get better; it'll be a good while before you've ACTUALLY hit your "limit". And rarely is your limit not good enough, sans competitive sports or what have you, where the best's best outbests the second

@meesterdude
meesterdude / product.rb
Created April 19, 2012 22:54
trying to get @product_results to not contain products who are already in a given @category
class Product < ActiveRecord::Base
has_and_belongs_to_many :product_groups
...
scope :in_categories, lambda {|ids| where(:category_id => ids) }
scope :visible, where(:visible => true)
scope :search, lambda {|kw| where(
#!/usr/bin/env macruby
framework 'Cocoa'
# Cocoa documentation reference:
# http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Classes/NSSound_Class/Reference/Reference.html
def play_sound
if @sound.empty?
NSApplication.sharedApplication.terminate(nil)
else
sound_file = @sound