Skip to content

Instantly share code, notes, and snippets.

View citizen428's full-sized avatar

Michael Kohl citizen428

View GitHub Profile
@citizen428
citizen428 / wp-xml-import.rb
Created September 25, 2011 16:19 — forked from zanshin/wp-xml-import.rb
WordPress to Textile Ruby script (I used a Textile plugin for WP). Parses all existing WP categories and tags into discreet list of categories. Finally forces all content to be UTF-8.
require 'fileutils'
require 'date'
require 'yaml'
require 'rexml/document'
include REXML
doc = Document.new(File.new(ARGV[0]))
FileUtils.mkdir_p "_posts"

Gist Clients

Want to create a Gist from your editor, the command line, or the Services menu? Here's how.

Editor Support

require 'clojure'
class MyClojureObj < Clojure::Object
def initialize
dosync { @foo = 'foo' }
end
def foo; @foo; end
def foo=(f); @foo = f; end
end
# Reincarnation for classes
class Class
def reincarnate
buried = Object.__send__(:remove_const, self.name)
Object.const_set(self.name, Class.new(buried))
end
end
class Abc
# This is how you can get a user's location using MacRuby and CoreLocation
framework 'CoreLocation'
def locationManager(manager, didUpdateToLocation: new_location, fromLocation: old_location)
puts "location: #{new_location.description}"
exit
end
loc = CLLocationManager.alloc.init
loc.delegate = self