Skip to content

Instantly share code, notes, and snippets.

Bill Turner billturner

Block or report user

Report or block billturner

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:293799
basedir = "/media_drop/xml_video/"
@ready_videos = Dir.glob("*.xml")
View MongoDB
# init.d script with LSB support.
# Copyright (c) 2007 Javier Fernandez-Sanguino <>
# This is free software; you may redistribute it and/or modify
# it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2,
# or (at your option) any later version.
billturner / reset.sass
Created Jan 25, 2010 — forked from bak/reset.sass
A local copy of the handy sass version of reset.css - thanks bak!
View reset.sass
// Copyright 1995-2007 Eric A. and Kathryn S. Meyer
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
View _post_form.haml
=f.label :title, :caption => "Post Title"
=f.text_field :title, :value => @post.title, :size => 50
=f.label :body, :caption => "Post Body"
=find_and_preserve do
=f.text_area :body
View simple_db_conn.rb
require 'rubygems'
require 'active_record'
ActiveRecord::Base.logger =
:adapter => 'mysql',
:database => 'jasons_db',
:username => 'root',
:password => 'password',
:host => 'localhost')
View harmony.rb
module Harmony
# Allows accessing config variables from harmony.yml like so:
# Harmony[:domain] =>
def self.[](key)
unless @config
raw_config = + "/config/harmony.yml")
@config = YAML.load(raw_config)[RAILS_ENV].symbolize_keys
View gist:195479
%a{ :href => permalink_url(post), :rel => 'bookmark', :title => "Permanent link for this post" }= post.title
=find_and_preserve do
-if post.tags.count > 0
-post.tags.each do |tag|
%a{ :href => tag_url(tag), :rel => 'category tag', :title => "View other posts tagged with '#{}'" }= "##{}"
View post.rb
class Post
attr_accessor :taglist
include DataMapper::Resource
property :id, Serial
property :title, String, :length => 255
property :slug, String, :length => 255
property :body, Text
property :published, Boolean, :default => false
View gist:50765
def assign_tags(tags)
tags.split(',').collect {|t| t.strip}.uniq.each do |tag|
thistag = Tag.first_or_create(:name => tag.downcase)
PostTagging.create(:post_id =>, :tag_id =>
def update_tags(tags)
self.post_taggings.each { |tagging| tagging.destroy }
You can’t perform that action at this time.