This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
==Summary | |
These instructions detail the configuration of an MS SQL database connection | |
(and the associated software required) for Ruby on Rails or ActiveRecord. They | |
rely heavily on input from a variety of blogs (noted with asterisks). | |
I tested these during the setup of a dev workstation on a Mac Pro with OS X | |
and a Preview server running CentOS and Plesk 8.6.0. | |
It seems that ADO doesn't work (or is a nightmare to get working) on a Linux |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################### | |
# place in /app/helpers/application_helper.rb # | |
############################################### | |
def bodytag_id | |
a = controller.class.to_s.underscore.gsub(/_controller$/, '') | |
b = controller.action_name.underscore | |
"#{a}-#{b}".gsub(/_/, '-') | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ***************************************** | |
# .irbrc | |
# | |
# Tim Harvey - Literacy5 | |
# http://literacy5.com/ | |
# | |
# Includes tons of visual sugar, based on the | |
# work of: | |
# | |
# UnixMonkey - http://gist.github.com/254551 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Convert all ERB templates to HAML in app/views/ | |
# | |
# Notes | |
# -- Will delete the existing erb templates | |
# -- This is a tweaked version from http://snippets.dzone.com/posts/show/6838 | |
# | |
# Usage | |
# -- Save as 'hamlize.rb' in APP_PATh/script/ | |
# -- Run with 'ruby script/hamlize.rb' in your app root |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Colorize the terminal Git display | |
git config --global color.interactive always | |
git config --global color.diff always | |
git config --global color.status always | |
git config --global color.branch always |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ----------------------------------------- | |
# Extract DB to YML in Rails | |
# (Put this in "extract_fixtures.rake" in | |
# the lib/tasks folder) | |
# ----------------------------------------- | |
namespace :db do | |
desc 'Create YAML test fixtures from data in an existing database. Defaults to development database. Set RAILS_ENV to override.' | |
task :extract_fixtures => :environment do | |
sql = "SELECT * FROM %s" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ***************************************** | |
# Bootstrap an app DB, loading up sample | |
# data and performing any db population | |
# via Faker tasks (db:populate:all) | |
# | |
# Comment out the db:populate line if you | |
# don't have any population tasks and only | |
# need to erase/reload the db from | |
# migrations and sample data | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- f.fields_for :user_achievements do |child_form| | |
- if child_form.object.user == @user #This is stupid and dangerous | |
= blah blah blah | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ----------------------------------------- | |
# Oh My Zsh theme | |
# ----------------------------------------- | |
# Inspired by "xiong-chiamiov" and "robbyrussell" | |
# Looks like: | |
# ┌─[tharvey@macbook] - [~/code/test_project] - [git:master ✗ Changed ✗] | |
# └─[$]>➜ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Tweet < ActiveRecord::Base | |
def self.latest_text | |
if Tweet.first.nil? || Tweet.first.created_at < ENV['CACHE_TIMEOUT'].to_i.minute.ago | |
begin | |
httpauth = Twitter::HTTPAuth.new(ENV['TWITTER_USR'], ENV['TWITTER_PWD']) | |
client = Twitter::Base.new(httpauth) | |
Tweet.delete_all | |
client.user_timeline.each do |tweet| |
OlderNewer