Skip to content

Instantly share code, notes, and snippets.

Avatar
🐼
PANDAS!

Jason L Perry ambethia

🐼
PANDAS!
View GitHub Profile
View test_helper.rb
# Allows you to use the :session key in your tests
# (when using rack-test).
#
# get "/", {}, :session => {:user => 1}
#
class Test::Unit::TestCase
include Rack::Test::Methods
def app
Sinatra::Application
View factories.rb
Factory.define :application do |factory|
factory.attachment(:sample, "public/samples/sample.doc", "application/msword")
end
@ambethia
ambethia / seeds.rb
Created Sep 15, 2009
Using environment specific yaml fixtures as seed data in Rails 2.3.4
View seeds.rb
# == Using environment specific yaml fixtures as seed data in Rails 2.3.4
#
# Setup your directory structure like below:
#
# -- RAILS_ROOT
# `-- db
# |-- seeds
# | |-- development
# | | |-- books.yml
# | | `-- users.yml
@ambethia
ambethia / nginx
Created Oct 19, 2009
Nginx Configs
View nginx
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: nginx init.d script for Ubuntu 8.10 and lesser versions.
# Description: nginx init.d script for Ubuntu 8.10 and lesser versions.
### END INIT INFO
View book_search.rb
require "rubygems"
require "httparty"
require "isbn"
module Book; end unless defined? Book
module Book::Search
include HTTParty
base_uri "books.google.com"; format :xml
class << self
@ambethia
ambethia / tasks.rake
Created Nov 12, 2009
Rake: Copy configuration files from templates
View tasks.rake
namespace :config do
desc "Copy configuration files from templates"
task :copy do
for file in Dir.glob("config/*.tpl") do
system "cp -vi #{file} config/#{File.basename(file,".tpl")}"
end
end
end
@ambethia
ambethia / tasks.rake
Created Nov 12, 2009
Rake: Write out a database.yml with settings for a test environment
View tasks.rake
namespace :db do
namespace :test do
desc "Write out a database.yml with settings for a test environment"
task :config do
File.open(Rails.root + "config/database.yml", "w") do |config|
config << <<-END_YAML.gsub(/^ {10}/, '')
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
View import_export.rb
# -- Export
require 'csv'
CSV.open('books.csv', 'w') do |file|
Book.all.each {|b|
file << [
b.isbn, b.sku_number, b.title,
b.author_family, b.author_given, b.author, '',
b.edition, b.description, b.sale_price,
b.cover.try(:full_filename),
View compass_template.rb
sass_dir = ask("Where would you like to keep your sass files within your project? (default: 'app/stylesheets')")
sass_dir = "app/stylesheets" if sass_dir.blank?
css_dir = ask("Where would you like Compass to store your compiled css files? (default: 'public/stylesheets')")
css_dir = "public/stylesheets" if css_dir.blank?
compass_command = "compass --rails . --css-dir=#{css_dir} --sass-dir=#{sass_dir} "
file 'vendor/plugins/compass/init.rb', <<-CODE
# This is here to make sure that the right version of sass gets loaded (haml 2.2) by the compass requires.
View mangos-tbb-on-linux_pcc.diff
diff --git a/dep/tbb/include/tbb/tbb_machine.h b/dep/tbb/include/tbb/tbb_machine.h
index 0673f24..e17c2d4 100644
--- a/dep/tbb/include/tbb/tbb_machine.h
+++ b/dep/tbb/include/tbb/tbb_machine.h
@@ -61,6 +61,8 @@ extern "C" __declspec(dllimport) int __stdcall SwitchToThread( void );
#include "machine/linux_intel64.h"
#elif __ia64__
#include "machine/linux_ia64.h"
+#elif __powerpc__
+#include "machine/mac_ppc.h"