Skip to content

Instantly share code, notes, and snippets.

View trevmex's full-sized avatar

Trevor Menagh trevmex

View GitHub Profile
trevmex / 10.9.1.txt
Last active August 29, 2015 13:57
Mac OS X build failure for gs-rest-service
$ uname -a
Darwin 13.0.0 Darwin Kernel Version 13.0.0: Thu Sep 19 22:22:27 PDT 2013; root:xnu-2422.1.72~6/RELEASE_X86_64 x86_64
$ java -version
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)
$ mvn -version
Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 11:22:22-0400)
Maven home: /usr/local/Cellar/maven/3.1.1/libexec
Java version: 1.6.0_65, vendor: Apple Inc.
trevmex / hal+metadata.json
Created May 1, 2014 01:16
An example of HAL JSON with Metadata
"_type": "",
"_links": {
"self": { "href": "/orders" },
"curies": [{ "name": "ea", "href": "{rel}", "templated": true }],
"next": { "href": "/orders?page=2" },
"ea:find": {
"href": "/orders{?id}",
"templated": true
### Keybase proof
I hereby claim:
* I am trevmex on github.
* I am trevmex ( on keybase.
* I have a public key whose fingerprint is 9E7E 1FCC 1894 727B E845 ADC9 F105 E554 39A1 A7D9
To claim this, I am signing this object:
# In all comments :stage represents the stage you want to use (i.e. production, staging, etc.)
# Follow these steps AFTER modifying your /etc/apache2/httpd.conf file to add a new rails instance and running `sudo apachectl restart`
# Steps to setup capistrano for the first time:
# - cap :stage deploy:setup # this creates the correct directory tree
# - cap :stage deploy:check # this checks to make sure setup ran
# - cap :stage deploy:update # this updates the server with the app code
# - ssh :user@:main_server # fill in the correct user and server here
# - cd :deploy_to/current # again fill in the correct deploy to dir
# - RAILS_ENV=:stage sudo rake gems:install # this installs gems that need native compiling
class ActiveDirectoryUser
require 'restclient'
@authentication_site = 'https://your_server'
@find_site = 'http://your_server'
@authentication_prefix = '/your_auth_page'
@find_prefix = '/cgi-bin/'
# Returns true if the user has the correct password, false otherwise.
def self.authenticate(login, password)
Factory.define :user , :class => User do |u|
u.sequence(:login) {|l| "user#{l}"}
u.sequence(:persistence_token) {|l| "#{Authlogic::Random.hex_token}"}
Factory.define :user , :class => User do |u|
u.add_attribute 'id', 1 # calls the id method of the class instead of assigning an attribute 'id'
u.login "trevor"
OK, I figured it out. Dumb mistake: to create an optional format like
you see in `rake routes` as:
classify_user_asset GET /users/:user_id/assets/:id/edit/
class(.:format) {:action=>"classify", :controller=>"assets"}
you would write:
map.with_options :controller => 'assets', :conditions => {:method
=> :get} do |assets|
assets.classify_user_asset '/users/:user_id/assets/:id/edit/
class.:format', :action => 'classify'
module ActiveResource
class Base
# Returns the raw data to display the thumbnail of an Alfresco document
def thumbnail
if self.doclib
Net::HTTP.start(, do |http|
req =, {'Content-Type' => 'image/png'})
req.basic_auth self.class.user, self.class.password
trevmex / install_homebrew.rb
Created May 24, 2010 13:02 — forked from mxcl/install_homebrew.markdown
Install in any directory via command line arguments. The default behavior is still intact.
# Download and execute this script in one-line with no temporary files:
# ruby -e "$(curl"
# 24th May 2010 (trevmex):
# Adapted mxcl's fork:
# Changed mxcl's code to include a prefix command line variable to allow