Skip to content

Instantly share code, notes, and snippets.

# 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
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) {
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
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?
> 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
---
title: The Tumblr Gem
state: queue
format: markdown
tags: Ruby, Tumblr, Weary
slug: tumblr-rb
---
Last night, I released the [Tumblr gem](http://github.com/mwunsch/tumblr), a command line utility and Ruby library for interacting with Tumblr. Here's what it does:
#!/usr/bin/env ruby
## WP2TUMBLR: WordPress 2 Tumblr Importing tool
##
## Usage: wp2tumblr [OPTION] WORDPRESS_XML_FILE
##
## Import the WORDPRESS_XML_FILE to a Tumblr blog.
## Provide `--group` option to publish to a group.
## This could take a long time...
##
## To install, download the script and chmod to 755.
#!/usr/bin/env ruby
## TumblrPurge: Destroy everything.
##
## *************WARNING*************
##
## USE THIS SCRIPT AT YOUR OWN RISK!
## I TAKE NO RESPONSIBILITY.
##
## This will destroy every Tumblr post.
## There is no undo.
#!/usr/bin/env ruby
## TumblrBak: Gets posts.
##
begin
require 'optparse'
require 'rubygems'
require 'tumblr'
require 'highline/import'
rescue LoadError
irb(main):005:0> m = mark.to_h
=> {:fn=>"Mark Wunsch", :title=>["Front End Engineer at Scripps Networks"], :n=>{:family_name=>["Wunsch"], :given_name=>["Mark"]}, :adr=>[{:locality=>["Greater New York City Area"]}]}
irb(main):006:0> m.to_yaml
ArgumentError: wrong number of arguments (1 for 0)
from /usr/local/lib/ruby/1.8/yaml/rubytypes.rb:41:in `to_yaml'
from /usr/local/lib/ruby/1.8/yaml/rubytypes.rb:41:in `node_export'
from /usr/local/lib/ruby/1.8/yaml/rubytypes.rb:41:in `add'
from /usr/local/lib/ruby/1.8/yaml/rubytypes.rb:41:in `to_yaml'
from /usr/local/lib/ruby/1.8/yaml/rubytypes.rb:40:in `each'
from /usr/local/lib/ruby/1.8/yaml/rubytypes.rb:40:in `to_yaml'