Skip to content

Instantly share code, notes, and snippets.

Avatar
🤖

Michael Kohl citizen428

🤖
View GitHub Profile
@citizen428
citizen428 / wp-xml-import.rb
Created Sep 25, 2011 — 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.
View wp-xml-import.rb
require 'fileutils'
require 'date'
require 'yaml'
require 'rexml/document'
include REXML
doc = Document.new(File.new(ARGV[0]))
FileUtils.mkdir_p "_posts"
View clients.md

Gist Clients

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

Editor Support

View 1. cloby.rb
require 'clojure'
class MyClojureObj < Clojure::Object
def initialize
dosync { @foo = 'foo' }
end
def foo; @foo; end
def foo=(f); @foo = f; end
end
View reincarnation.rb
# 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
View user_location.rb
# 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
You can’t perform that action at this time.