Skip to content

Instantly share code, notes, and snippets.

View bishopandco's full-sized avatar
😈
CRUSHMODE

Michael Bishop bishopandco

😈
CRUSHMODE
View GitHub Profile
li.product_customizations.collect{|x| x.customized_product_options if x.customized_product_options.last.customizable_product_option_id == 3}.reject{|x| x == nil}
=> [[#<Spree::CustomizedProductOption id: 740, product_customization_id: 731, customizable_product_option_id: 3, value: "https://signaturesettings-artwork.s3.amazonaws.com/...", created_at: "2013-06-21 14:58:56", updated_at: "2013-06-21 14:58:56", customization_image: nil>]]
@bishopandco
bishopandco / index.html
Created December 5, 2012 01:39 — forked from mbostock/.block
Curved textPath
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<!--[if lte IE 8]>
<script type="text/javascript" src="http://webmonarch.github.com/d34raphael/d3/lib/sizzle/sizzle.js"></script>
<script type="text/javascript" src="http://webmonarch.github.com/d34raphael/d3/lib/ie8/compat.js"></script>
<![endif]-->
<script type="text/javascript" src="http://webmonarch.github.com/d34raphael/d3/lib/raphael/raphael.js"></script>
<script type="text/javascript" src="http://webmonarch.github.com/d34raphael/d3/d3.v2.js"></script>
@bishopandco
bishopandco / message_theme.rb
Created September 6, 2012 03:00
Message Theming
class MessageTheme
def self.message_theming(week,year)
TwitterWeeklySampleMessage.primary_key="id"
BlogWeeklySampleMessage.primary_key="id"
FacebookWeeklySampleMessage.primary_key="id"
weekly_samples = WeeklySample.includes({:property => :tags}, :facebook_weekly_sample_messages, :blog_weekly_sample_messages, :twitter_weekly_sample_messages).where(:week_number => week,:year => year)
@bishopandco
bishopandco / Colorized Logger
Created May 22, 2012 01:20 — forked from esmarkowski/Colorized Logger
beautiful colorized messages.
module ActiveSupport
class BufferedLogger
module Severity
COLORIZE = 10
end
include Severity
def add(severity, message = nil, progname = nil, &block)
return if @level > severity
message = (message || (block && block.call) || progname).to_s
message = "\e[0;45m#{message}\e[0;0m\n" if severity == 10
def sign_in_out_button
out = []
if current user
out << link_to "Sign out", '/logout', :class => "login_button round"
else
out << link_to "Sign in (or up)", '/login', :class => "login_button round"
end
end
#!/usr/bin/env python
# Convert a mysql dump into a sqlite-compatible format.
# I wrote this for just one script... no guarantess that it will work with others...
# python fsql.py < mysqldump.sql > readyforsqlite.sql
import re
import sys
content = sys.stdin.read()