Skip to content

Instantly share code, notes, and snippets.

View hannahwhy's full-sized avatar

Hannah Yip hannahwhy

View GitHub Profile
<wms-config>
<server>
<auto-discovery run="true" period="0"/>
<datafilestore>
<config-file>wms.DataFileStore.xml</config-file>
</datafilestore>
@hannahwhy
hannahwhy / convert.rb
Created November 24, 2012 23:16
PNG -> GeoTIFF conversion for Blue Marble PNGs
def trans_lat(lat)
lat =~ /([0-9]+)([NS])/
num, dir = $1.to_i, $2
dir == 'S' ? -num : num
end
def trans_long(long)
long =~ /([0-9]+)([EW])/
// this is set to validation/helpers
(function (ex) {
var knownTypes = [
'event',
'profile',
'source_resolution',
'video'
];
ex.isKnownType = function (type) {
Contact:
comments: contact_comment
contact_date: contact_date_date
contact_id: contact_id
disposition: contact_disposition
distance_traveled: contact_distance
end_time: contact_end_time
interpreter: contact_interpret_code
interpreter_other: contact_interpret_other
language: contact_language_code
require 'celluloid/io'
class EchoServer
include Celluloid::IO
def initialize(host, port)
@server = TCPServer.new(host, port)
run!
end
class Array
def extract_options!
last.is_a?(::Hash) ? pop : {}
end
def tail
head, *tail = *self
tail
end
{ 0 => ->{ "foobar" } }
root PUT|POST / front_page#update
root / front_page#show
edit /edit(.:format) front_page#edit
login GET /login(.:format) sessions#login
POST /login(.:format) sessions#create
logout /logout(.:format) sessions#destroy
videos GET /videos(.:format) videos#index
POST /videos(.:format) videos#create
new_video GET /videos/new(.:format) videos#new
edit_video GET /videos/:id/edit(.:format) videos#edit
@hannahwhy
hannahwhy / lol.rb
Created April 10, 2012 08:06
This feels wrong, but it works
require 'catalog/model'
module Catalog::Model
##
# Defines a schema for a model object.
#
# Schemas look like this:
#
# class Video
# include Catalog::Model
@hannahwhy
hannahwhy / 00
Created April 8, 2012 19:16
I can't tell if this is smart or stupid
The problem:
I want to be able to have attribute readers for a CouchDB document. Why? So I
can use Action Pack's form builder with said document.
Here's an example document:
{ "title": "A video",
"audio": [
{ "artist": "Dot Dot Dot",