Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View zanshin's full-sized avatar
💭
Making mistakes so you don't have to since 1961.

Mark Nichols zanshin

💭
Making mistakes so you don't have to since 1961.
View GitHub Profile
require 'fileutils'
require 'date'
require 'yaml'
require 'rexml/document'
include REXML
doc = Document.new File.new(ARGV[0])
FileUtils.mkdir_p "_posts"
@zanshin
zanshin / gist:1117462
Created August 1, 2011 02:09 — forked from imathis/gist:1104557
FIX for Lion's posix_spawn_ext.bundle: [BUG] Segmentation fault

The segfault problem with posix_spawn is indeed caused by Lion's compiler being LLVM and not GCC by default. However, when I installed RVM, the notes suggested that on Lion you need to add export CC=/usr/bin/gcc-4.2 to your shell startup file (.bashrc or .zshrc as appropriate). I did that, but it seems that's what caused problems: while ruby 1.9.2 needs you to use GCC to install it, using the same compiler for the gems apparently causes breakage.

First, you need to install XCode 4.x, which is now a free (though hefty!) download from the Mac App Store. Without that, you have no gcc, so you won't get anywhere ;-)

Next, what you need to do is clear out your rvm ruby and the associated gems (make sure you are cd'd into your octopress repository then do:

rvm remove ruby-1.9.2 --gems --archive

which will clear everything out so that you can start from scratch. Obviously, if you have other stuff you've installed for other purposes using RVM, be careful with this. If you previously had the export CC li

@zanshin
zanshin / Importing posts from Wordpress into Jekyll.rb
Created August 1, 2011 15:57 — forked from vitobotta/Importing posts from Wordpress into Jekyll.rb
The script I used to import posts from my Wordpress blog into a new Jekyll one.
%w(rubygems sequel fileutils yaml active_support/inflector).each{|g| require g}
require File.join(File.dirname(__FILE__), "downmark_it")
module WordPress
def self.import(database, user, password, table_prefix = "wp", host = 'localhost')
db = Sequel.mysql(database, :user => user, :password => password, :host => host, :encoding => 'utf8')
%w(_posts _drafts images/posts/featured).each{|folder| FileUtils.mkdir_p folder}
@zanshin
zanshin / wp-xml-import.rb
Created August 9, 2011 01:56
WordPress to Markdown ruby script. Parses existing WP categories into discreet list of categories. Also identifies link-style postings and sets a YAML attribute to identify those entries. 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"
@zanshin
zanshin / zanshin.zsh-theme
Created August 12, 2011 19:02
My oh-my-zsh theme, a derivative of the Soliah theme
# Shows little symbol '±' if you're currently at a git repo and '○' all other times
function prompt_char {
git branch >/dev/null 2>/dev/null && echo '±' && return
echo '○'
}
PROMPT='
%{$fg[blue]%}%n%{$reset_color%} on %{$fg[yellow]%}%m%{$reset_color%} in %{$fg[green]%}%~%b%{$reset_color%} $(git_time_since_commit)$(check_git_prompt_info)
${vcs_info_msg_0_}$(prompt_char) '
@zanshin
zanshin / .zshrc
Created August 12, 2011 19:09
My .zshrc file
# Path to your oh-my-zsh configuration.
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
#export ZSH_THEME="robbyrussell"
export ZSH_THEME="zanshin"
@zanshin
zanshin / newpost.rb
Created August 18, 2011 21:12
Create and Isolate a new Posting for Octopress
#!/usr/bin/env ruby
#
# newpost.rb new-post-title
#
# Author: Mark Nichols, 8/2011
#
# This script automates the process of creating a new Octopress posting.
# 1. The Octopress rake new_post task is called passing in the posting name
# 2. The Octopress rake isolate taks is called to sequester all other postings in the _stash
# 3. The new file is opened in TextMate
@zanshin
zanshin / exitwp-yaml
Created September 16, 2011 19:17
exitwp output showing YAML heading
---
author: mark
date: '2011-07-29 23:40:59'
layout: post
slug: google-fonts
status: publish
title: Google Fonts
wordpress_id: '2751'
categories:
- nerdliness
@zanshin
zanshin / octopress-yaml
Created September 16, 2011 19:20
Octopress style YAML header example
---
layout: post
title: Google Fonts
date: 2011-7-29
comments: true
categories: nerdliness
link: false
---
After reading about them and looking them over, I've finally decided to take the font plunge using <a title="Google Web Fonts" href="http://www.google.com/webfonts#ChoosePlace:select">Google Fonts</a>. The process couldn't be easier, and the results are worth the few minutes time it takes.
@zanshin
zanshin / figureHover.css
Created September 20, 2011 02:49
CSS to expand figure elements on hover
// hover style to expand figures
article { overflow: visible; }
figure:hover { width: 800px; }