Skip to content

Instantly share code, notes, and snippets.

View ashgti's full-sized avatar

John Harrison ashgti

View GitHub Profile
## router.rb
namespace :admin do
match('/').to(:controller => 'dash', :action => 'index').name(:dash)
resources :users
resources :teams
resources :seasons do
resources :games
end
end
Merb.logger.info("Compiling routes...")
Merb::Router.prepare do
authenticate do
namespace :admin do
match('/').to(:controller => 'dash', :action => 'index').name(:dash)
resources :users
resources :teams
resources :seasons do
resources :games
end
require 'rubygems'
gem 'dm-core'
require 'dm-core'
require 'pp'
DataMapper.setup(:default, 'sqlite3::memory:')
DataMapper::Logger.new(STDOUT, :info)
DataObjects::Sqlite3.logger = DataObjects::Logger.new(STDOUT, 0)
<html>
<head>
<title>Hello World</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script>
$(document).read(function () {
alert("hello World");
});
</script>
class HelloWorld
def call(env)
[200, {"Content-Type" => "text/plain"}, ["Hello world!"]]
end
end
Rack::Handler::FastCGI.run(HelloWorld)
require 'rubygems'
gem 'dm-core'
require 'dm-core'
DataMapper.setup(:default, 'sqlite3::memory:')
DataMapper::Logger.new(STDOUT, :debug)
DataObjects::Sqlite3.logger = DataObjects::Logger.new(STDOUT, :debug)
class User
include DataMapper::Resource
require 'rubygems'
require 'dm-core'
require 'dm-more'
require 'dm-timestamps'
require 'dm-is-versioned'
DataMapper.setup(:sqlite3, 'sqlite3::memory:')
DataMapper::Repository.adapters[:default] = DataMapper::Repository.adapters[:sqlite3]
DataMapper::Logger.new(STDOUT, :debug)
DataObjects::Sqlite3.logger = DataObjects::Logger.new(STDOUT, :debug)
require 'rubygems'
require 'ruby-prof'
# Add the local gems dir if found within the app root; any dependencies loaded
# hereafter will try to load from the local gems before loading system gems.
if (local_gem_dir = File.join(File.dirname(__FILE__), '..', 'gems')) && $BUNDLE.nil?
$BUNDLE = true; Gem.clear_paths; Gem.path.unshift(local_gem_dir)
end
require "merb-core"
/**********************************************************************
gc.c -
$Author: shyouhei $
$Date: 2008-08-03 22:24:26 -0500 (Sun, 03 Aug 2008) $
created at: Tue Oct 5 09:44:46 JST 1993
Copyright (C) 1993-2003 Yukihiro Matsumoto
Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
class Application < Merb::Controller
def check(one, two, *args)
hey = 'one'
@@one = other
a = two unless one.gsub /(test|another)*?/
end
def other
@other
end