Skip to content

Instantly share code, notes, and snippets.

View allanwhite's full-sized avatar

Allan White allanwhite

View GitHub Profile
@ls-lukebowerman
ls-lukebowerman / gist:3677503
Created September 8, 2012 17:24
IndexTank/JSON Sitemap Generator for Middleman
<%
entries = []
pages = sitemap.resources
pages = pages.find_all{|p| p.source_file.match(/\.html/) && !p.directory_index? && p.data.hide_listing != true }
pages.each do |article|
file = File.open(article.source_file,'r')
file_contents = file.read.split('---').last.gsub(/\t|\n/,' ')
content = Nokogiri::HTML(file_contents).xpath("//text()").to_s
@d6y
d6y / process.sh
Created July 11, 2012 17:58
Batch convert HTML to Markdown
#!/bin/bash
# Converts HTML from https://exportmyposts.jazzychad.net/ exports to Markdown
POSTS_DIR=/Users/richard/Desktop/d6y/posts
for file in $POSTS_DIR/*.html
do
echo $file
@jackmcdade
jackmcdade / twitter-bootstrap2-with-structure.js
Created March 19, 2012 21:50
Twitter Bootstrap2 with Structure
{exp:structure:nav max_depth="2" show_depth="2" current_class="active" css_class="nav" has_children_class="dropdown"}
<script>
$(function() {
$('ul li.dropdown').each(function() {
$(this).children('ul').addClass("dropdown-menu"); // add children dropdown menu class
$(this).children('a').append('<b class="caret"></b>') // add caret icon
$(this).clone().prependTo($(this).find('ul')).removeClass('dropdown active').children('ul').remove(); // clone parent link into child menu
$(this).children('a').attr('data-toggle', 'dropdown').attr('href', '#').addClass("dropdown-toggle"); // add data attributes to hook up Bootstrap
});
/*!
* jQuery TextChange Plugin
* http://www.zurb.com/playground/jquery-text-change-custom-event
*
* Copyright 2010, ZURB
* Released under the MIT License
*/
(function ($) {
$.event.special.textchange = {