Skip to content

Instantly share code, notes, and snippets.

View timmatheson's full-sized avatar
💭
Seeking new roles

Tim Matheson timmatheson

💭
Seeking new roles
View GitHub Profile
<h5>Tab 1</h5>
<!-- Tab 1 content Start -->
<div>
<p>Tab 1 content</p>
</div>
<!-- Tab 1 content end -->
<h5>Tab 2</h5>
<!-- Tab 2 content Start -->
<div>
<p>Tab 2 content</p>
<!-- Retweet App Snippet -->
<link rel='stylesheet' href='http://localhost:3000/assets/retweet.css' />
<script src="//platform.twitter.com/widgets.js"></script>
<script src="http://localhost:3000/assets/api.js?t=1"></script>
<script type='text/javascript'>
var asset_url = "{{ shop.metafields.retweeter.tab_image | asset_url }}";
jQuery(document).ready(function(){
RetweetApi.init({{ shop.metafields.retweeter | json }}, asset_url);
});
</script>
@timmatheson
timmatheson / gist:4252424
Created December 10, 2012 18:43
action_controller_hack.rb
class ActionController::Base
def self.body_class(&block)
if block_given?
content_for :body_class yield block if block_given?
end
end
end
task :test_divide => :environment do
 puts (12/2).class
end
@timmatheson
timmatheson / railsify.sh
Created November 19, 2012 21:23
Rails Setup
#!/bin/bash
ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
curl -L https://get.rvm.io | bash -s stable --rails
brew install mysql
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
mysql.server start
echo -e "\033[32m You are all set and ready to rock!\033[0m"
#require 'config/environment'
class Entry
attr_accessor :completed_on
end
module EntryUpdate
def delete!(id)
if entry = Entry.find(id)
entry.destroy
end
module Verdacom
module Base
def fallbacks(*args, &block)
yield Fallback.new if block_given?
end
class Fallback
attr_accessor :resolver
def initialize
#!/usr/local/bin/bin/ruby
require 'rubygems'
require 'mechanize'
require 'redis'
@redis = Redis.new
@count_key = 'shopify:metarific:install_count'
a = Mechanize.new
def growl( message )
# old
def self.load_or_initialize_tz(timezone_name)
first(:conditions => ["RIGHT(tz_name, ?) = ? OR tz_name = ?", timezone_name.size, timezone_name, timezone_name]) || self.first || self.new(tz_name: timezone_name)
end
# new
def self.load_or_initialize_tz( timezone_name )
first(:conditions => {:tz_name => timezone_name }) || first || new(:tz_name => timezone_name)
end
require 'rubygems'
require 'aasm'
class User < ActiveRecord::Base
include AASM
aasm_state :new, :initial => true
aasm_state :advanced
aasm_state :expert