Skip to content

Instantly share code, notes, and snippets.

@ryanflorence
ryanflorence / gitrss.rb
Created July 14, 2010 18:37
Create an RSS 2.0 feed from a git log
# Adapted by Ryan Florence (http://ryanflorence.com)
# original by Chris Dinger: http://www.houseofding.com/2009/03/create-an-rss-feed-of-your-git-commits/
#
# Takes one, two, or three arguments
# 1. Repository path (required) - the path to the repository
# 2. The url to put as the <link> for both channel and items
# 3. the repository name, defaults to directory name of the repository
#
# Command line usage:
# ruby gitrss.rb /path/to/repo > feed.rss
@ryanflorence
ryanflorence / Rules.rb
Created July 14, 2010 20:07
Rules file for nanoc site that does a few nice things
#!/usr/bin/env ruby
# A few helpful tips about the Rules file:
#
# * The order of rules is important: for each item, only the first matching
# rule is applied.
#
# * Item identifiers start and end with a slash (e.g. “/about/” for the file
# “content/about.html”). To select all children, grandchildren, … of an
# item, use the pattern “/about/*/”; “/about/*” will also select the parent,
@ryanflorence
ryanflorence / GitExtractor.rb
Created July 15, 2010 02:47
Ruby class to archive and extract a git repository
#!/usr/bin/env ruby
require 'fileutils'
class GitExtractor
# Exports a git archive
#
# Arguments: params (hash)
# * path - path to git repository
# * branch - branch to extract
@ryanflorence
ryanflorence / post-receive.rb
Created July 16, 2010 20:03
Ruby Git post-receive hook to parse out the stdin and assign them to variables
#!/usr/bin/env ruby
# figure out which repository this is
# assumes it's a bare repository
repository = /([^\/]*?)\.git$/.match(`pwd`.chomp)[1]
# get the stdins from git
stdins = []; stdins << $_ while gets
stdins.each do |str|
@ryanflorence
ryanflorence / moo4q-slideshow.diff
Created July 23, 2010 22:07
What it took to port SlideShow to a jQuery moo4q plugin
diff --git a/slideshow.js b/slideshow.js
index 44d4e1d..72c21e4 100644
--- a/slideshow.js
+++ b/slideshow.js
@@ -37,12 +37,14 @@ var SlideShow = new Class({
autoplay: false
},
+ jQuery: 'slideshow',
+
@ryanflorence
ryanflorence / todo.rb
Created August 11, 2010 18:05
CLI + TextMate todo list management
#!/usr/bin/env ruby
# place or symlink this script somewhere in your path and then
#
# $ todo category long description of task
#
# todo script creates a new file and opens it up in textmate
# take back your task manager, geeks!
Dir.chdir('/path/to/todo/directory/')
@ryanflorence
ryanflorence / FBLikeButton.html
Created September 17, 2010 20:20
Vanilla JS implementation to dynamically create facebook like buttons.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv=Content-type content="text/html; charset=utf-8">
<title></title>
</head>
<body>
<div id=container>
<ul>
#!/usr/bin/env ruby
# Aside from removing Ruby on Rails specific code this is taken verbatim from
# mislav's git-deploy (http://github.com/mislav/git-deploy) and it's awesome
# - Ryan Florence (http://ryanflorence.com)
#
# Install this hook to a remote repository with a working tree, when you push
# to it, this hook will reset the head so the files are updated
if ENV['GIT_DIR'] == '.'
@ryanflorence
ryanflorence / static_server.js
Last active July 3, 2025 03:26
Node.JS static file web server. Put it in your path to fire up servers in any directory, takes an optional port argument.
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
, filename = path.join(process.cwd(), uri);
@ryanflorence
ryanflorence / head.html
Created December 2, 2010 17:48
HTML Layout Addition
<!--[if lt IE 7 ]> <body class="ie6"> <![endif]-->
<!--[if IE 7 ]> <body class="ie7"> <![endif]-->
<!--[if IE 8 ]> <body class="ie8"> <![endif]-->
<!--[if IE 9 ]> <body class="ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <body> <!--<![endif]-->