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
Merb::BootLoader.before_app_loads do | |
# This will get executed after dependencies have been loaded but before your app's classes have loaded. | |
Date.add_format(:tranzaction_date, '%m/%d/%y') | |
class ::DataMapper::Validate::ValidationErrors | |
def each | |
errors.map.each do |k, v| | |
next if v.blank? | |
yield(k, v) | |
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
require "rubygems" | |
require "dm-core" | |
require "dm-validations" | |
require "spec" | |
DataMapper.setup(:default, "sqlite3::memory:") | |
module MarkForDestruction | |
def mark_for_destruction | |
@marked_for_destruction = true |
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
require "rubygems" | |
require "dm-core" | |
require "spec" | |
DataMapper.setup(:default, "sqlite3::memory:") | |
class Person | |
include DataMapper::Resource | |
property :id, Serial | |
has 1, :profile |
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
require "rubygems" | |
require "dm-core" | |
require "dm-constraints" | |
require "dm-validations" | |
require "spec" | |
DataMapper::Logger.new(STDOUT, :debug) | |
DataMapper.setup(:default, 'mysql://localhost/dm-playground') | |
class Person |
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
require 'rubygems' | |
require 'pathname' | |
require 'extlib' | |
require 'haml' | |
# helper | |
def render_ken_resource(ken_resource) | |
Ken::Render::Factory.create_renderer(ken_resource).render |
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
module Addressable | |
include DataMapper::Resource | |
is :remixable | |
# ... | |
end | |
module Linkable | |
include DataMapper::Resource | |
is :remixable | |
# ... |
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
require 'rubygems' | |
require 'dm-core' | |
DataMapper::Logger.new(STDOUT, :debug) | |
DataMapper.setup(:default, 'sqlite3::memory:') | |
class Person | |
include DataMapper::Resource | |
property :id, Serial | |
has n, :projects |
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
# This is all you need to setup datamapper on a given repository | |
# (the sqlite3 in memory adapter in this case). | |
# | |
# If you ever happen to feel the need to report a ticket for datamapper, | |
# it greatly helps the developers if you wrap a drilled down example | |
# that demonstrates your error in the same format that's used here. | |
# If someone asks you to put together a standalone script that demonstrates | |
# the error, it should roughly look like this file you're currently reading | |
# | |
# Everyone can just run this file by issuing: "ruby filename.rb" |
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
#!/usr/bin/env ruby | |
# | |
# A one file test to show ... | |
require 'rubygems' | |
require 'dm-core' | |
require 'dm-validations' | |
# setup the logger | |
DataMapper::Logger.new(STDOUT, :debug) | |
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
# local dev box in austria | |
mungo:alfred snusnu$ git ls-remote origin | |
18fb8e6a6ed2bf14b680e8aa4ad1473b034004ac HEAD | |
18fb8e6a6ed2bf14b680e8aa4ad1473b034004ac refs/heads/master | |
4a1619a0e5955cfd58b744a709d89a96206f9736 refs/heads/style | |
# EY slice somewhere i dunno :) | |
snusnu@ey04-s00167 ~/github/alfred $ git ls-remote origin |