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
# These two lines of code kind of do the same thing. | |
# They both add the directory of the file the Ruby interpreter | |
# is currently executing to the Load Path. | |
# Useful when no gem is installed. | |
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__))) unless $LOAD_PATH.include?(File.expand_path(File.dirname(__FILE__))) | |
$:.unshift File.dirname(__FILE__) |
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
require 'nokogiri' | |
# = XmlMini Nokogiri implementation | |
module ActiveSupport | |
module XmlMini_Nokogiri #:nodoc: | |
extend self | |
# Parse an XML Document string into a simple hash using libxml / nokogiri. | |
# string:: | |
# XML Document string to parse |
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
# Converting Nokogiri parsed XML to_hash | |
require 'nokogiri' | |
module Extensions | |
module Document | |
def to_hash | |
root.to_hash | |
end | |
end | |
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
# DSL method ideas (for Weary) | |
class Twitter < Weary::Base | |
on_domain 'http://twitter.com/' | |
as_format :json | |
declare_resource 'statuses/user_timeline', | |
:via => :get, | |
:with => [:id], | |
:forms_url => "#{domain}#{resource}.#{format}?#{query}" |
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
require 'active_resource/connection' | |
require 'active_support/core_ext/kernel/reporting' | |
module ActiveResource | |
class InvalidRequestError < StandardError; end #:nodoc: | |
# One thing that has always been a pain with remote web services is testing. The HttpMock | |
# class makes it easy to test your Active Resource models by creating a set of mock responses to specific | |
# requests. | |
# |
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
# 1) Point *.example.com in your DNS setup to your server. | |
# | |
# 2) Setup an Apache vhost to catch the star pointer: | |
# | |
# <VirtualHost *:80> | |
# ServerName example.com | |
# ServerAlias *.example.com | |
# </VirtualHost> | |
# | |
# 3) Set the current account from the subdomain |
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
var Messages = { | |
loader: jQuery('<div class="loading">Loading...</div>'), | |
thanks: jQuery('<div class="success">Thanks! We\'ll stay in touch!</div>'), | |
error: jQuery('<div class="ajax-error">Oh no. Something really terrible happened</div>'), | |
}; | |
var contact_form = jQuery('#contact-form'); | |
var colorBox = jQuery.fn.colorbox; | |
jQuery('#email-form').validate({ | |
submitHandler: function(form) { |
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
require 'pp' | |
require 'rubygems' | |
require 'weary' | |
class Repository < Weary::Base | |
# inherit from Base | |
get "show_weary" do |r| | |
r.url = 'http://github.com/api/v2/json/repos/show/mwunsch/weary' | |
r.with = :login, :token |
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
status = Weary.get("http://twitter.com/statuses/user_timeline") do |r| | |
r.with = {:id => 'markwunsch'} | |
end | |
status.before_send do |request| | |
puts "Sending a request to #{request.uri}" | |
end | |
status.on_complete do |response| | |
if response.success? |
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
> Mark Wunsch's Custom Quix Commands | |
> | |
> Sort of inspired by Merlin Mann's Custom Quix Commands | |
> http://github.com/merlinmann/quix-mann | |
> | |
> http://quixapp.com | |
@Mark Wunsch's Custom Quix Commands | |
subscribe javascript:var%20b=document.body;var%20GR________bookmarklet_domain='http://www.google.com';if(b&&!document.xmlVersion)%7Bvoid(z=document.createElement('script'));void(z.src='http://www.google.com/reader/ui/subscribe-bookmarklet.js');void(b.appendChild(z));%7Delse%7Blocation='http://www.google.com/reader/view/feed/'+encodeURIComponent(location.href)%7D Subscribe in Google Reader | |
tumblr javascript:var%20d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f='http://www.tumblr.com/share',l=d.location,e=encodeURIComponent,p='?v=3&u='+e(l.href)%20+'&t='+e(d.title)%20+'&s='+e(s),u=f+p;try%7Bif(!/%5E(.*%5C.)?tumblr%5B%5E.%5D*$/.test(l.host))throw(0);tstbklt();%7Dcatch(z)%7Ba%20=function()%7Bif(!w.open(u,'t','toolbar=0,resizable=0,status=1,width=450,heig |
OlderNewer