This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'core_ext' | |
module Metahackery | |
# Object concatentation, singleton multiple inheritence, singleton mixin, etc... | |
# This object allows you to smash two objects together into one object that | |
# appears to be any of the sub-objects depending on how you look at it. | |
class Cat | |
instance_methods.each { |m| undef_method m unless m =~ /(^__|^nil\?$|^send$|proxy_|^object_id$)/ } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Walk a sitemap and report timings and stuff. | |
Copyright (c) 2008 Dustin Sallings <[email protected]> | |
""" | |
import sys | |
import time | |
import getopt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
A script to tell you who actually wrote your current codebase. | |
Usage: | |
git ls-files | xargs -n 1 git annotate | ./who-wrote-this.py | |
Copyright (c) 2008 Dustin Sallings <[email protected]> | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Copyright (c) 2007 Andy Parkins | |
# | |
# An example hook script to mail out commit update information. This hook | |
# sends emails listing new revisions to the repository introduced by the | |
# change being reported. The rule is that (for branch updates) each commit | |
# will appear on one email and one email only. | |
# | |
# This hook is stored in the contrib/hooks directory. Your distribution |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby -w | |
class O | |
def yield | |
puts "Yielded." | |
end | |
def do | |
puts "Doing." | |
end | |
def def |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<!-- Copyright (c) 2008 Dustin Sallings <[email protected]> --> | |
<html lang="en"> | |
<head> | |
<title>Relativity.</title> | |
<style type="text/css"> | |
img { border: 0; margin-right: 2px; } | |
textarea { overflow: scroll; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import random | |
if __name__ == '__main__': | |
colors=('red', 'green', 'yellow', 'blue') | |
limbs=('left foot', 'right foot', 'left hand', 'right hand') | |
print random.choice(limbs), random.choice(colors) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# moved to http://gist.github.com/41462 | |
def whack(objects) | |
Hash[ *objects.map{|o| [o.send('table_name'), o.send('delete_all')]}.flatten] | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def whack(objects) | |
Hash[*objects.map{|o| [o.send('table_name'), o.send('delete_all')]}.flatten] | |
end | |
# or (depending on what "send" means there) | |
def whack(objects) | |
Hash[*objects.map{|o| [o.table_name, o.delete_all]}.flatten] | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a sample script for upstart to keep a twisted project running. | |
# Place it in /etc/event.d/[projectname] | |
description "useful description" | |
author "Dustin Sallings <[email protected]>" | |
start on runlevel 2 | |
start on runlevel 3 | |
stop on runlevel 0 |
OlderNewer