Skip to content

Instantly share code, notes, and snippets.

View davetron5000's full-sized avatar

David Copeland davetron5000

View GitHub Profile
@davetron5000
davetron5000 / god.rb
Last active August 29, 2015 14:00
Since we don't need TDD anymore, this is the best way to write tests after you've hand-crafted your code to be beautiful
class God < ActiveRecord::Base
has_many :purchases
has_many :orders
has_many :login_attempts
has_many :friends
acts_as_taggable because: "all tags are the same"
scope :alive, -> { where.not(:status => :dead) }
scope :active, -> { where(:inactive => false) }
merch_date | merch_week_name | merch_year | merch_month | merch_quarter | merch_season
------------+-----------------+------------+-------------+---------------+---------------
2014-01-01 | Dec W5 | 2013 | Dec | Q2 | Fall / Winter
2014-01-02 | Dec W5 | 2013 | Dec | Q2 | Fall / Winter
2014-01-03 | Dec W5 | 2013 | Dec | Q2 | Fall / Winter
2014-01-04 | Dec W5 | 2013 | Dec | Q2 | Fall / Winter
2014-01-05 | Jan W1 | 2014 | Jan | Q2 | Fall / Winter
2014-01-06 | Jan W1 | 2014 | Jan | Q2 | Fall / Winter
2014-01-07 | Jan W1 | 2014 | Jan | Q2 | Fall / Winter
@davetron5000
davetron5000 / bundler_assets.rb
Created April 10, 2014 14:21
This is my imagined way in which Bundler could manage front-end assets without having to wrap them first in RubyGems, but just deciding to use bower
source 'https://[email protected]/me/' # private gem repo
source 'https://rubygems.org' # canonical rubygems
asset_source 'https://[email protected]' # if someday this could exist
asset_source 'https://bower.io' # canonical bower sources
gem "rails" # gem == RubyGem, do what we do now
asset "angular" # look in Bower public server, using its API
asset "colors", git: "[email protected]:stitchfix/colors" # look in git repo for bower.json
asset "jquery", cdn: "code.jquery.com/jquery-1.11.0.min.js" # satisfies deps, but doesn't download anything
11:11:10 web.1 | started with pid 77035
11:11:10 compass.1 | started with pid 77036
11:11:10 web.1 | Configuration file: _config.yml
11:11:10 web.1 | Configuration file: _development_config.yml
11:11:10 web.1 | Source: /Users/davec/Projects/growingdevs.github.io
11:11:10 web.1 | Destination: /Users/davec/Projects/growingdevs.github.io/_site
11:11:10 web.1 | Generating... Conversion error: There was an error converting '_posts/2013-09-09-welcome-to-growingdevs-com.md/#excerpt'.
11:11:10 web.1 | error: incompatible encoding regexp match (UTF-8 regexp with ASCII-8BIT string). Use --trace to view backtrace
11:11:10 web.1 | exited with code 1
11:11:10 system | sending SIGTERM to all processes

Here it is:

diff --git a/README.rdoc b/README.rdoc
index 2ff9aa6..b15475f 100644
--- a/README.rdoc
+++ b/README.rdoc
@@ -1,11 +1,5 @@
 = bookinggit
 
class HooksRegistry
def hooks(name)
end
def clear_hooks(name)
end
def register_hook(name, &block)
end

This is

class SomeRubyCode
end

Here is a diff

module SomeMixin
def doit
puts "HELLO!"
end
end
class IncludesMixin
include SomeMixin
end
[user]
name = Dave Copeland
email = [email protected]
[core]
excludesfile = /Users/davec/.gitignore
[color]
branch = auto
diff = auto
status = auto
[color "branch"]
#!/usr/bin/env ruby
require 'pp'
urls = {}
users = {}
explained = {
"/admin_additions/recommend_more_items" => {
function: "styling",