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",
@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 / 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
@Oshuma
Oshuma / specs.watchr.rb
Created November 3, 2009 07:44 — forked from mynyml/specs.watchr.rb
specs.watchr.rb
# Run me with:
#
# $ watchr specs.watchr.rb
# --------------------------------------------------
# Convenience Methods
# --------------------------------------------------
def all_test_files
Dir['test/**/*_test.rb'] - ['test/test_helper.rb']
end
@Oshuma
Oshuma / authentication.rb
Created November 20, 2009 17:47 — forked from jnunemaker/authentication.rb
mongo_auth
# include this in application controller
module Authentication
protected
# Inclusion hook to make #current_user and #signed_in?
# available as ActionView helper methods.
def self.included(base)
base.send :helper_method, :current_user, :signed_in?, :authorized? if base.respond_to? :helper_method
end
# Returns true or false if the user is signed in.
@Oshuma
Oshuma / database.yml
Created November 21, 2009 21:30 — forked from jnunemaker/database.yml
mongo_mapper + database.yml
development: &default_settings
database: APPNAME_development
host: 127.0.0.1
port: 27017
test:
<<: *default_settings
database: APPNAME_test
production:
@Oshuma
Oshuma / Jabber-SH.rb
Created January 29, 2010 08:50 — forked from pcreux/Jabber-SH
#!/usr/bin/env ruby
# Jabber-SH — SH console via XMPP/Jabber (GTalk)
#
# Jabber-SH allows you to administrate a remote computer via a command line
# through a Jabber client. It’s like SSH via GoogleTalk! :)
# This is just a hack but it might be usefull sometime to run basic commands
# on a machine that is not accessible via ssh.
#
# Philippe Creux. pcreux/AT/gmail/DOT/com
require 'rubygems'
require 'sinatra'
require 'json'
def json_get(route, options={}, &block)
get(route, options) do
content_type 'text/json'
block.call.to_json
end
end
require 'rubygems' if RUBY_VERSION =~ /1\.8/
require 'rack'
require "#{File.dirname(__FILE__)}/webapp"
if __FILE__ == $0
def usage
STDERR.puts("Usage: #{$0} <webrick, thin, mongrel>")
exit
end
@Oshuma
Oshuma / restore
Created October 27, 2017 00:41 — forked from jgillman/restore.sh
pg_restore a local db dump into Docker
# Assumes the database container is named 'db'
DOCKER_DB_NAME="$(docker-compose ps -q db)"
DB_HOSTNAME=db
DB_USER=postgres
LOCAL_DUMP_PATH="path/to/local.dump"
docker-compose up -d db
docker exec -i "${DOCKER_DB_NAME}" pg_restore -C --clean --no-acl --no-owner -U "${DB_USER}" -d "${DB_HOSTNAME}" < "${LOCAL_DUMP_PATH}"
docker-compose stop db