Skip to content

Instantly share code, notes, and snippets.

Avatar

Don Park donpdonp

View GitHub Profile
View fist
_ ,-, _
,--, /: :\/': :`\/: :\
|`; ' `,' `.; `: |
| N | E | R | D |.
| :L | I | F | E ||
| :. | : | . | : | \
\__/: :.. : :.. | :.. | )
`---',\___/,\___/ /'
`==._ .. . /'
`-::-'
View gist:465669
class Diaria < ActiveRecord::Base
has_many :itens, :class_name => "DiariaItem"
def gerarItensDiaria
itens.create({:tipo => 3,
:quantidade => diaria_com_pernoite,
:valor => 150.00})
end
end
View proposed changes to permit
create_table "permits", :force => true do |t|
t.string "number", :null => false
t.string "name", :null => false
t.string "agency_project"
t.integer "contact_id"
t.string "category"
t.string "when_req"
t.string "owner"
t.string "renewable"
t.boolean "startup_monitoring_reqd"
View json format for geo data
Common minimal format for sending just lat/long data
[
{
uuid: "550e8400-e29b-41d4-a716-446655440000",
date: "2010-04-30T16:50:00Z",
location: {
position: {
geojson: { "type": "Point",
"coordinates": [11.0, 61.0] }
}
View gist:186896
module States
STATES = %w(cancelled declined passive active approved pending flagged complete)
attr_accessor :state # remove this if using an activerecord column
def self.included(mod)
STATES.each do |state|
up_state = state.upcase
mod.const_set(up_state, state)
mod.send(:define_method, state+'?') do
You can’t perform that action at this time.