Tweet photo with #mongoatl to win!
Fur bus will shuttle back & forth to after-party, where there are 2 free drinks
Will cover:
- Data modeling, queries, geospacial, updates, map-reduce
- Using location-based app as an example
#!/usr/bin/ruby | |
# Written by Emily Price <http://duien.com> Feb 4, 2009 | |
# Feel free to use and modify | |
# The code makes a few assumptions about how you use org-mode: | |
# Assumes you're using org-odd-levels-only and that you have the TODO keywords 'TODO', 'DONE', and 'CANCEL' defined | |
require 'rubygems' | |
require 'sqlite3' |
class Time | |
def aprox_eql? (time2, interval) | |
raise ArgumentError, 'Invalid Time object' unless time2.kind_of? Time | |
raise ArgumentError, 'Invalid interval' unless [:year, :month, :mon, :day, :hour, :min, :sec, :usec].include? interval | |
case interval | |
when :year | |
self.year == time2.year | |
when :month, :mon | |
self.year == time2.year and self.month == time2.month | |
when :day |
require 'mongo' | |
describe "MongoDB" do | |
before(:all) do | |
@db = Mongo::Connection.new.db('test').collection('index_test') | |
@db.drop | |
@db.create_index( 'a' ) | |
@db.insert( { 'a' => 1 } ) | |
@db.insert( { 'b' => 1 } ) | |
end |
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'set' | |
puts "looking for the gems to upgrade..." | |
gem_info = Struct.new(:name, :version) | |
to_reinstall = Set.new | |
Dir.glob("#{Gem.dir}/**/*.bundle").map do |path| | |
path =~ /.*1.8\/gems\/(.*)-(.*?)\/.*/ | |
name, version = $1, $2 |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>name</key> | |
<string>Railscasts</string> | |
<key>settings</key> | |
<array> | |
<dict> | |
<key>settings</key> |
#!/bin/sh | |
# | |
# init.d script with LSB support. | |
# | |
# Copyright (c) 2007 Javier Fernandez-Sanguino <[email protected]> | |
# | |
# This is free software; you may redistribute it and/or modify | |
# it under the terms of the GNU General Public License as | |
# published by the Free Software Foundation; either version 2, | |
# or (at your option) any later version. |
describe LeadService do | |
# Get the Sinatra application instance that ran the current test. For instance you | |
# could use: | |
# | |
# it "should set an instance variable" do | |
# get '/' | |
# app_instance.instance_variable_get(:@lead).should_not be_nil | |
# end | |
# |
ruby-1.8.7-p302 > require 'builder' | |
=> true | |
ruby-1.8.7-p302 > xm = Builder::XmlMarkup.new | |
=> <inspect/> | |
ruby-1.8.7-p302 > xm.title('yada') | |
=> "<inspect/><title>yada</title>" | |
ruby-1.8.7-p302 > puts xm | |
TypeError: Builder::XmlMarkup#to_ary should return Array | |
from (irb):5:in `puts' | |
from (irb):5 |
function time_to_glitch(time){ | |
var year, day_of_year, month_and_day, month, day_of_month, hour, minute, sec, ts ; | |
sec = Number(time) - 1238562000; | |
// there are 4435200 real seconds in a game year | |
// there are 14400 real seconds in a game day | |
// there are 600 real seconds in a game hour | |
// there are 10 real seconds in a game minute | |
year = Math.floor(sec / 4435200); |