Skip to content

Instantly share code, notes, and snippets.

View Oshuma's full-sized avatar

Dale Campbell Oshuma

View GitHub Profile
// Based on apidock.org Ubiquity Search: http://gist.github.com/8132
// Edited to use favicon.ico
CmdUtils.CreateCommand(
{
name: "code",
takes: {"function": noun_arb_text},
icon: "http://github.com/favicon.ico",
homepage: "http://tiago.zusee.com",
author: {name: "Tiago Bastos", email: "comechao@gmail.com"},
license: "MPL,GPL",
// Insert a map, based on IP GeoLocation.
CmdUtils.CreateCommand({
name: "map-me",
description: "Dynamically insert a map, based on IP GeoLocation.",
_getMapUrl: function() {
var loc = CmdUtils.getGeoLocation();
var mapUrl = "http://maps.google.com/staticmap?";
var params = {
@Oshuma
Oshuma / weewar.js
Created November 23, 2008 01:51
Ubiquity command set for WeeWar (http://weewar.com/)
Oshuma = {
homepage: "http://corrupt.save-state.net",
author: { name: "Dale Campbell", email: "dale@save-state.net"},
license: "WTFPL"
};
WeeWar = {
_baseUrl: "http://weewar.com/api1",
_siteIcon: "http://weewar.com/favicon.ico",
class LookAt
DEFAULTS = {:output => true}
def initialize(thing, options = {})
@thing = thing
@options = DEFAULTS.merge(options)
meths = case @thing.class
when Class, Module
(@thing.methods.sort - Class.methods)
else
@Oshuma
Oshuma / benchmark-erb-form.log
Created November 27, 2008 15:15
Simple merb app in production mode; 5000 requests, 5 concurrent.
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Server Software:
Server Hostname: 127.0.0.1
Server Port: 4000
@Oshuma
Oshuma / init.rb
Created November 29, 2008 02:29 — forked from henrik/init.rb
Simple Settings object for Merb.
Merb::BootLoader.before_app_loads do
# This will get executed after dependencies have been loaded but before your app's classes have loaded.
require 'config/settings'
end
@Oshuma
Oshuma / app_config.yml
Created November 29, 2008 15:59
Super simple Merb configuration.
# config/app_config.yml
# Keep this out of version control if you have sensitive information!!
defaults: &defaults
name: Super Awesome Blog
tagline: My super awesome blog and stuff.
email: you@example.org
development:
<<: *defaults
# Override the defaults.
def create(comment)
@article = Article.get(params[:article_id])
@comment = Comment.new(comment.merge(:article => @article))
if @comment.save
redirect resource(@article), :message => {:notice => 'Your comment was saved.'}
else
redirect resource(@article), :message => {:error => 'Must fill in all fields.'}
end
end
@Oshuma
Oshuma / gist:30473
Created November 30, 2008 16:35
Merb spec helpers to test authenticated actions.
def create_article(options = {})
create_and_authenticate_user
Article.all.destroy!
request(resource(:articles), :method => "POST",
:params => { :article => { :id => nil, :title => 'Title',
:content => 'Blog post.' }})
end
def create_and_authenticate_user
User.all.destroy!
@Oshuma
Oshuma / itunes.rb
Created November 30, 2008 17:56 — forked from sunny/README
#!/usr/bin/env ruby
# Small app to control your Itunes via HTTP.
#
# Usage: `$ ruby itunes.rb`, then visit `http://localhost:4567`
# Requires sinatra: `$ sudo gem install sinatra`
require 'rubygems'
require 'sinatra'
get '/do' do