Skip to content

Instantly share code, notes, and snippets.

View vaskom's full-sized avatar

Vasko Markovski vaskom

View GitHub Profile
@vaskom
vaskom / Capfile
Created February 24, 2010 23:39 — forked from mig/Capfile
require 'capistrano/version'
load 'deploy'
# Customize the following variables
set :domain, "host.example.com"
set :user, "username"
set :application, "my_wordpress_blog"
set :deploy_to, "/var/www/apps/#{application}"
# These variables probably don't need to change
# Run rake db:size to get a print of your database size in bytes.
# Run rake db:tables:size to get the sizes for individual tables
# Works for MySQL and PostgreSQL. Not tested elsewhere.
namespace :db do
desc 'Print data size for entire database'
task :size => :environment do
database_name = ActiveRecord::Base.connection.instance_variable_get("@config")[:database]
adapter = ActiveRecord::Base.connection.adapter_name.downcase
<ul><r:find url="/">
<r:children:each><li><r:link /></li>
</r:children:each></r:find></ul>
require 'pp'
require 'rubygems'
require 'mongo_mapper'
MongoMapper.database = 'testing'
class Rating
include MongoMapper::EmbeddedDocument
key :user_id, ObjectId
#!/usr/bin/ruby
module Helpers
LINE = 80
def announcing(msg)
print msg
yield
print "." * (LINE - msg.size - 6)
puts "\e[32m[DONE]\e[0m"
end
# include this in application controller
module Authentication
protected
# Inclusion hook to make #current_user and #signed_in?
# available as ActionView helper methods.
def self.included(base)
base.send :helper_method, :current_user, :signed_in?, :authorized? if base.respond_to? :helper_method
end
# Returns true or false if the user is signed in.
# mongo_template.rb
# fork of Ben Scofield's Rails MongoMapper Template (http://gist.github.com/181842)
# fork of Kyle Banker's Rails MongoMapper Template (http://gist.github.com/219223)
#
# To use:
# change url by raw link in http://gist.github.com/242007
# rails project_name -m http://gist.github.com/gists/242007.txt
# remove unneeded defaults
run "rm public/index.html"
# mig_rails_template.rb
file 'config/routes.rb', <<-CODE
ActionController::Routing::Routes.draw do |map|
end
CODE
run "rm public/index.html"
run "rm public/images/rails.png"
run "rm public/favicon.ico"
@vaskom
vaskom / Gemfile
Created January 27, 2010 02:04 — forked from rmanalan/.gems
gem 'rack-contrib', :git => 'git://github.com/rack/rack-contrib.git'
gem 'rack-rewrite'

Rails 2.3.5 on App Engine (DataMapper)

We assumed Rails 2 would never work without rubygems, and we committed to gem bunlder for JRuby on App Engine, so we were waiting for Rails 3. Fortunately, Takeru Sasaki was able to patch the Rails 2.3.5 calls to rubygems, and now we have it working. Rails 2.3.5 currently spins up several seconds faster than Rails 3, and just a few seconds behind Sinatra.

See the TinyDS version also: gist.github.com/269075

Install the Development Environment

The gems for the development environment include a pre-release appengine-tools gem that provides a pre-release version of jruby-rack.

sudo gem install google-appengine