View 10.9.1.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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. |
View hal+metadata.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"_type": "http://schema.org/QuantitativeValue/ProcessableOrders", | |
"_links": { | |
"self": { "href": "/orders" }, | |
"curies": [{ "name": "ea", "href": "http://example.com/docs/rels/{rel}", "templated": true }], | |
"next": { "href": "/orders?page=2" }, | |
"ea:find": { | |
"href": "/orders{?id}", | |
"templated": true | |
}, |
View gist:61f4e10502aa4ee6803f
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am trevmex on github. | |
* I am trevmex (https://keybase.io/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: |
View deploy.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
View ActiveDirectoryUser.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ActiveDirectoryUser | |
require 'restclient' | |
@authentication_site = 'https://your_server' | |
@find_site = 'http://your_server' | |
@authentication_prefix = '/your_auth_page' | |
@find_prefix = '/cgi-bin/dscl_search.sh?' | |
# Returns true if the user has the correct password, false otherwise. | |
def self.authenticate(login, password) |
View users.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Factory.define :user , :class => User do |u| | |
u.sequence(:login) {|l| "user#{l}"} | |
u.sequence(:persistence_token) {|l| "#{Authlogic::Random.hex_token}"} | |
end |
View users.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Factory.define :user , :class => User do |u| | |
u.add_attribute 'id', 1 # u.id calls the id method of the class instead of assigning an attribute 'id' | |
u.login "trevor" | |
end |
View _fixed.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
View extend_ares_for_alfresco.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ActiveResource | |
class Base | |
# Returns the raw data to display the thumbnail of an Alfresco document | |
def thumbnail | |
if self.doclib | |
begin | |
Net::HTTP.start(self.class.site.host, self.class.site.port) do |http| | |
req = Net::HTTP::Get.new(self.doclib, {'Content-Type' => 'image/png'}) | |
req.basic_auth self.class.user, self.class.password | |
http.request(req).body |
View install_homebrew.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# | |
# Download and execute this script in one-line with no temporary files: | |
# | |
# ruby -e "$(curl http://gist.github.com/raw/411826/install_homebrew.rb)" | |
# | |
# | |
# 24th May 2010 (trevmex): | |
# Adapted mxcl's fork: http://gist.github.com/323731 | |
# Changed mxcl's code to include a prefix command line variable to allow |
OlderNewer