Skip to content

Instantly share code, notes, and snippets.

View arbales's full-sized avatar

Austin Bales arbales

View GitHub Profile
<html>
<head>
<title>Checkbox</title>
<style>
input[type=checkbox] {
display:none;
}
input[type=checkbox] + label
{
Models = require("./def");
sys = require("sys");
sys.println = function(string){
sys.print(string + "\n");
}
NodeMapper = {};
NodeMapper.Resource = {};
Models.def ("Person")({
$$('a[href="<%=request.path_info%>"]').each(function(s){s.addClassName("selected")});
<?
/*
Copyright (c) 2010 Austin Robert Bales
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
class Table
# Checks if the table is available for a given time range.
#
# @param [Hash(Symbol => DateTime)] params
#
def available_at?(params)
if (params[:at].class != DateTime); raise ArgumentError, "Provide a DateTime for :at";end;
if (params[:ending].class != DateTime); raise ArgumentError, "Provide a DateTime for :ending";end;
return false if
@arbales
arbales / gist:264337
Created December 27, 2009 17:22 — forked from arbales/gist:261484
#!/usr/bin/env ruby -Ku
# encoding: utf-8
require 'rubygems'
require 'dm-core'
require 'dm-types'
DataMapper::Logger.new($stdout, :debug)
DataMapper.setup(:default, "sqlite3:///#{Dir.pwd}/examine.db")
class Table
include DataMapper::Resource
property :id, Serial
property :name, String
# Relationship to the join table.
has n, :tableBookings
# Defines that Table has bookings in :tableBookings on the :booking named relationship. (a)
#!/usr/bin/env ruby -Ku
# encoding: utf-8
require 'rubygems'
require 'dm-core'
require 'dm-types'
DataMapper::Logger.new($stdout, :debug)
#!/usr/bin/env ruby -Ku
# encoding: utf-8
require 'rubygems'
require 'dm-core'
DataMapper::Logger.new($stdout, :debug)
DataMapper.setup(:default, 'sqlite3::memory:')
#!/usr/bin/env ruby
#
# A one file test to show ...
require 'rubygems'
require 'dm-core'
# setup the logger
DataMapper::Logger.new(STDOUT, :debug)