Skip to content

Instantly share code, notes, and snippets.

Avatar

Tim Harper timcharper

View GitHub Profile
View add-a-sensible-suffix-to-the-log-path--to-get-rid-of-all-the-of-tiny-unix-epoch-suffixed-files.patch
From 57dc6a58baeed762981d1a28c0855e651c46982a Mon Sep 17 00:00:00 2001
From: Tim Harper <timcharper@gmail.com>
Date: Sat, 4 Oct 2008 10:05:49 -0600
Subject: [PATCH] add a sensible suffix to the log path, to get rid of all the of tiny unix epoch suffixed files
---
config/environments/production.rb | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/config/environments/production.rb b/config/environments/production.rb
@timcharper
timcharper / init.rb
Created Nov 20, 2008
very messy! (need to take out inline javascript and refactor)
View init.rb
require 'tabset_helpers.rb'
ActionView::Base.send(:include, TabsetHelpers)
View git-setup-pull.sh
#!/bin/bash
branch_name=$(sed 's|ref: refs/heads/||' .git/HEAD)
remote_name=${1:-origin}
remote_branch=${2:-$branch_name}
if [ "$branch_name" == "$(cat .git/HEAD)" ]; then
echo "You're not on a branch"
exit 1
fi
@timcharper
timcharper / ruby-enterprise.spec
Created Dec 13, 2008
Ruby Enterprise Edition RPM spec
View ruby-enterprise.spec
cat ruby-enterprise.spec
Summary: Ruby Enterprise Edition
Name: ruby-enterprise
Version: 1.8.6
Release: 20081205
License: GPL
Group: Applications/System
Source: ruby-enterprise-%{version}-%{release}.tar.gz
BuildRoot: /var/tmp/%{name}-%{version}-%{release}
%description
View custom_facts.rb
# put on the server
# put in /etc/puppet/custom/plugins/facter/custom_facts.rb
require 'yaml'
if File.exist?("/etc/puppet/custom_facts.yml")
YAML.load_file("/etc/puppet/custom_facts.yml").each do |key, value|
Facter.add(key.to_sym) do
setcode { value }
end
end
View hpricot_and_nokogiri.rb
html = <<-EOF
<html>
<body>
<table>
<tr>
<td>
One
<table><tr><td>Nested Cell #1</td></tr></table>
</td>
</tr>
View hpricot_and_nokogiri.rb
html = <<-EOF
<html>
<body>
<table>
<tr>
<td>
One
<table><tr><td>Nested Cell</td></tr></table>
</td>
</tr>
View example.js
top_left = new GLatLng(point.lat() - radius, point.lng() - radius),
bottom_right = new GLatLng(point.lat() + radius, point.lng() + radius)
this.rectangle = new GRectangle(
this.map,
top_left,
bottom_right,
{
line_color: (this.kind == "home") ? "#3355ff" : "#ff5533",
fill_color: (this.kind == "home") ? "#335599" : "#995533",
@timcharper
timcharper / spork
Created May 19, 2009
a fork of script/spec_server, which forks a copy of itself each time specs are run via DRB, giving you a fresh already-initialized copy each time
View spork
#!/usr/bin/env ruby
gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
puts "Loading Rails environment"
ENV["RAILS_ENV"] ||= 'test'
ENV["DRB"] = 'true'
require File.expand_path(File.dirname(__FILE__) + "/../config/environment") unless defined?(RAILS_ROOT)
require 'optparse'
View .autotest
require 'autotest/redgreen'
module Autotest::Growl
def self.notify(title, msg, img)
system("osascript ~/bin/growlNotify.scpt '#{title}' '#{msg.inspect}' '#{img}'")
end
Autotest.add_hook :ran_command do |at|
results = [at.results].flatten.join("\n")
# rpsec
You can’t perform that action at this time.