Try to use existing mysql under OSX.
$ sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
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
# song definition | |
tempo 120 | |
# bassline | |
instrument :bass, channel: 2 do | |
preset 'bass/fender_jazz_clean' | |
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
=== Snow Leopard, Ruby and MySQL | |
I was finally able to get the mysql 2.8.1 gem after a snow leopard upgrade. After trying many different builds, 64 vs. 32, etc, I ended up: | |
- removing the existing mysql bundle | |
$ sudo rm /Library/Ruby/Site/1.8/universal-darwin10.0/mysql.bundle | |
- installing 64-bit mysql 5.0 from the .dmg download | |
- building the gem with this command: |
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
# downsample large attachment_fu images | |
namespace :images do | |
desc "Downsample Large Images" | |
task :downsample_large => :environment do | |
count = Image.large.count # named scope | |
chunk_size = 500 | |
(0...(count/chunk_size)).each do |i| | |
images = Image.large.find(:all, :offset=>i*chunk_size, :limit=>chunk_size).each do |image| | |
image.downsample!(55) | |
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
class Image << ActiveRecord::Base | |
has_attachment :storage => :file_system, | |
:content_type => :image, | |
:processor => 'rmagick', | |
# ... | |
named_scope :large, :conditions => "size > #{1.megabytes}" | |
DEFAULT_QUALITY = 60 |
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
# Use spawn to fork the resize. | |
# you'll want to have the following lines in environment.rb: | |
# Spawn::method :fork, 'production' | |
# Spawn::method :yield, 'test' | |
def downsample!(quality=DEFAULT_QUALITY) | |
id = spawn do | |
image = Magick::ImageList.new(self.absolute_filename) | |
image.write("jpeg:#{self.absolute_filename}") {self.quality = quality} | |
end | |
wait(id) |
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
# example tests | |
test "geocoder is used when new point is saved" do | |
geocoder_should_be_used | |
p = Point.new(:address => ..., :city => ... ) | |
assert p.save | |
end | |
test "point will re-geocode if the address changes" do | |
gecoder_should_be_used # only once! |
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
# GeoKit geocoder mocks, place in test_helper.rb | |
# mocks | |
def geo_mock(options={}) | |
defaults = {:lat=>1, :lng=>2, | |
:precision=>'address', :success => true, | |
:street_address=>'address', :zip=>'12345', | |
:city=>'city', :state=>'state', | |
:full_address => 'full address'} | |
res = mock('response') |
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 your application-specific JavaScript functions and classes here | |
// This file is automatically included by javascript_include_tag :defaults | |
$(function() { | |
MIN_ANSWERS = 2 | |
MAX_ANSWERS = 10 | |
MIN_ANSWERS_MSG = "Minimum of two(2) answers required." | |
MAX_ANSWERS_MSG = "Maximum of ten(10) answers only." | |
TOP_ANSWER_MSG = "Can't go up answer is on the top list." |
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
<?php /* A simple PHP script to help test applications that access web pages. | |
It provides a reliable way to simulate normal page load, 500 and | |
404 errors, redirects, PDF download, variable response delays, | |
and a browser-killing huge text response. | |
To install, copy to your PHP-enabled web server. There are no other | |
dependencies. Access the script via your browser to see instructions. | |
http://gist.github.com/gists/473681 | |
July 2010 - Jeremy Seitz |
OlderNewer