This file contains 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
# Determine if the current directory is a GIT repo | |
# and print out '*' if there are changes to be committed | |
iz_git_dirty() { | |
#IZ_GIT=`git status 2>/dev/null` | |
IZ_DIRTY=`git status 2>/dev/null | grep 'nothing to commit (working directory clean)'` | |
#if [ "." != "$IZ_GIT." ]; then | |
if [ "." == "$IZ_DIRTY." ]; then | |
echo '*' | |
fi |
This file contains 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
# A version number is a kind of number | |
class VersionNumber < Numeric | |
attr_reader :parts, :labels, :literal | |
# Create a new VersionNumber | |
def initialize(literal=nil) | |
@parts = [0,0,0] # Numeric parts | |
@labels = ['major', 'minor', 'patch'] # Alpha parts | |
@literal = literal.to_s # The original literal |
This file contains 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
# Generates a patch by comparing two directories using a simple logfile format | |
# A relative/path for added files (will be directly copied) | |
# D relative/path for removed files (will be directly removed using the command defined in RM) | |
# M relative/path for modified files (will be included in the output patch) | |
olddir = ARGV[0] # Unchanged | |
newdir = ARGV[1] # Changes | |
unless olddir && newdir | |
warn 'ERROR, must pass two directories' |
This file contains 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 'rubygems' | |
require 'hpricot' | |
require 'open-uri' | |
require 'uri' | |
require 'cgi' | |
def get_doc(uri) | |
if uri.to_s =~ /explore\.twitter\.com/ | |
uri = URI.parse('http://twitter.com/' + uri.to_s.scan(/.+\/(.+)$/)[0][0]) |
This file contains 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
<?php | |
class Outline { | |
var $_fields = array(); | |
var $_subnodes = array(); | |
var $_constructed = false; | |
function Outline($data='',$options=array()) { | |
if($_constructed) return; | |
$this->__construct($data,$options); |
This file contains 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
<?php | |
require_once(dirname(__FILE__).'/Outline.php'); | |
class OutlineFromXML extends Outline { | |
var $_errorcode = 0; | |
function getError() { return $this->_errorcode; } | |
This file contains 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
<?php | |
require_once dirname(__FILE__).'/Outline.php'; | |
require_once dirname(__FILE__).'/OutlineFromXML.php'; | |
function checkXML($data) {//returns FALSE if $data is well-formed XML, errorcode otherwise | |
$rtrn = 0; | |
$theParser = xml_parser_create(); | |
if(!xml_parse_into_struct($theParser,$data,$vals)) { | |
$errorcode = xml_get_error_code($theParser); |
This file contains 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 | |
FLASHVARS=`curl -s "$*" | grep swfArgs | sed -e 's/: /=/g' | sed -e 's/, /\&/g' | sed -e 's/"//g' | sed -e 's/^.*{//g' | sed -e 's/}.*$//g'` | |
echo "http://youtube.com/get_video.php?$FLASHVARS" |
This file contains 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 | |
YT=`which yt` | |
if [ -z "$YT" ]; then | |
YT="`dirname $0`/yt" | |
fi | |
if [ -z "$YT" ]; then | |
echo "ERROR: could not find yt script" 1>&2 | |
exit 1 | |
fi |
This file contains 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
class Array | |
def invert | |
[1,2,3,4,5,6,7,8,9].select do |i| | |
! self.include?i | |
end | |
end | |
end | |
class Unsolvable < Exception | |
end |
OlderNewer