Skip to content

Instantly share code, notes, and snippets.

class Kalifornium < Padrino::Application
register Loader
end
class Kalifornium < Padrino::Application
def load_something
@a = 1; @b = 2
end
end
# app/models/bar.rb
class Bar
include DataMapper::Resource
# property <name>, <type>
property :id, Serial
property :name, String
# has many to many
has n, :foos, :through => Resource
end
class Component
include DataMapper::Resource
property :id, Serial
property :nome, String
property :descrizione, Text
property :prezzo_base, Float
property :base, Boolean
DataMapper.auto_migrate!
(1..5).each do |n|
PlantType.create(:nome => "nome_#{n}")
ComponentType.create(:nome => "nome_#{n}")
Supplier.create(:nome => "nome_#{n}")
Component.create(:nome => "nome_#{n}", :supplier => Supplier.first, :component_type => ComponentType.first)
end
params = {:supplier=> Supplier.get(1), :component_type => ComponentType.get(1), :nome => "ciao", :plant_types => PlantType.all(:id => "3,4".split(","))}
component = Component.first
DataMapper::Visualizer::Project library
- should add the include directories to the $LOAD_PATH
- should remove the include directories to the $LOAD_PATH
- should require the specified paths
DataMapper::Visualizer::Project rails
- should add the include directories to the $LOAD_PATH
- should remove the include directories to the $LOAD_PATH
- should require all paths that match the specified glob patterns
waydotnet-laptop:~/.rvm/src/rvm (master) $ ruby -v
ruby 1.8.7 (2010-08-16 patchlevel 302) [x86_64-linux]
waydotnet-laptop:~/.rvm/src/rvm (master) $ gem list
*** LOCAL GEMS ***
bundler (1.0.2)
rake (0.8.7)
waydotnet-laptop:~/.rvm/src/rvm (master) $ bundle install
Could not locate Gemfile
DataMapper::Visualizer::Visualization full names
- should not demodulize the names of Classes
- should not demodulize the names of Objects (FAILED - 1)
- should not demodulize property type names
- should not demodulize model names
1)
'DataMapper::Visualizer::Visualization full names should not demodulize the names of Objects' FAILED
expected: "DataMapper::Property",
got: "DataMapper::Property::Text" (using ==)
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<style>img{ height: 100px; float: left; }</style>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
</head>
<body>
<div id="images">
</div>
<script>
@WaYdotNET
WaYdotNET / align.el
Created November 15, 2010 14:40
Align function emacs
;; Align command !!!
;; from http://stackoverflow.com/questions/3633120/emacs-hotkey-to-align-equal-signs
;; another information: https://gist.github.com/700416
;; use rx function http://www.emacswiki.org/emacs/rx
(defun align-to-colon (begin end)
"Align region to colon (:) signs"
(interactive "r")