Skip to content

Instantly share code, notes, and snippets.

View arbales's full-sized avatar

Austin Bales arbales

View GitHub Profile
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
<?
/*
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
$$('a[href="<%=request.path_info%>"]').each(function(s){s.addClassName("selected")});
Models = require("./def");
sys = require("sys");
sys.println = function(string){
sys.print(string + "\n");
}
NodeMapper = {};
NodeMapper.Resource = {};
Models.def ("Person")({
<html>
<head>
<title>Checkbox</title>
<style>
input[type=checkbox] {
display:none;
}
input[type=checkbox] + label
{
function urlify(text) {
var urlRegex = /(https?:\/\/[^\s]+)/g;
return text.replace(urlRegex, function(url) {
return '<a href="' + url + '">' + url + '</a>';
})
// or alternatively
// return text.replace(urlRegex, '<a href="$1">$1</a>')
}
@arbales
arbales / StorageManager.js
Created November 8, 2010 19:11
Aids in interacting with the HTML5 localStorage API. Moved to a proper repo and fixed.
// ## StorageManager
// Aids in interacting with the HTML5 localStorage API.
StorageManager = {
// Returns the data associated with a key or `false` of no data exists.
get: function(key){
var data = localStorage.getItem(key);
if (data === "" || data === null){
return false;
} else {
backend default {
.host = "localhost";
.port = "8000";
}
sub vcl_recv {
if (req.http.x-forwarded-for) {
set req.http.X-Forwarded-For = req.http.X-Forwarded-For ", " client.ip;
} else {
set req.http.X-Forwarded-For = client.ip;
source "life://127.0.0.1"
gem "knowledge"
gem "happiness"
gem "longevity", "~>85.0", :require => "age"
gem "health"
gem "responsibility", "0.5.1a"
gem "wisdom"
gem "fun"
module Mycroft
module Action
class Base
def initialize(options)
@options = options
end
def self.create(options)
self.new(options).save