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 'net/http' | |
require 'uri' | |
require 'time' | |
class Time | |
def self.gcalschema(tzid) # We may not be handling Time Zones in the best way... | |
tzid =~ /(\d\d\d\d)(\d\d)(\d\d)T(\d\d)(\d\d)(\d\d)Z/ ? # yyyymmddThhmmss | |
# Strange, sometimes it's 4 hours ahead, sometimes 4 hours behind. Need to figure out the timezone piece of ical. | |
# Time.xmlschema("#{$1}-#{$2}-#{$3}T#{$4}:#{$5}:#{$6}") - 4*60*60 : | |
Time.xmlschema("#{$1}-#{$2}-#{$3}T#{$4}:#{$5}:#{$6}") : |
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
#!/usr/bin/ruby | |
class WalkDirTree | |
def each_file(&block) | |
raise ArgumentError unless block_given? | |
@each_file = block | |
end | |
def walk!(dir='.') | |
current_directory = Dir.pwd |
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
local_rubygems = !!($:[0] == '.') | |
$:.shift if local_rubygems # Takes off the extra '.' put on the beginning. Now the next line will require the real rubygems | |
# Now require the REAL rubygems. | |
# (we're going to FREEZE it next) | |
load 'rubygems.rb' | |
$:.unshift('.') if local_rubygems | |
module Gem | |
Sandbox = { | |
'merb-core' => '=0.9.7', |
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 'socket' | |
require 'openssl' | |
require 'net/ftp' | |
class Net::FTPS < Net::FTP | |
end | |
class Net::FTPS::Implicit < Net::FTP | |
FTP_PORT = 990 |
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 'active_record/connection_adapters/abstract_adapter' | |
require 'bigdecimal' | |
require 'bigdecimal/util' | |
# msaccess_adapter.rb -- ActiveRecord adapter for Microsoft Access Db | |
# | |
# "Adapted" from the sqlserver_adapter.rb for Microsoft SQL Sever: | |
# Author: Joey Gibson <[email protected]> | |
# |
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
# First, mkdir name & chdir name | |
git init | |
git remote add -t $2 origin $1 | |
git fetch | |
git checkout --track -b $2 origin/$2 |
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 'socket' | |
socket = TCPServer.new('0.0.0.0', '8080') | |
socket.setsockopt(Socket::SOL_SOCKET, Socket::SO_REUSEADDR, 1) | |
loop do | |
client = socket.accept | |
data = '' | |
loop do | |
event = select([client],nil,nil,0.5) | |
if client.eof? # Socket's been closed by the client |
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
String::ALPHANUMERIC_CHARACTERS = ('a'..'z').to_a + ('A'..'Z').to_a | |
def String.random(size) | |
length = String::ALPHANUMERIC_CHARACTERS.length | |
(0...size).collect { String::ALPHANUMERIC_CHARACTERS[Kernel.rand(length)] }.join | |
end |
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
#!/usr/bin/perl -w | |
# Small program to process a tiff file into a PDF and email it via gmail. | |
# | |
# Distributed under the terms of the GNU General Public License (GPL) Version 2 | |
# Copyright 2005 by Rob Thomas ([email protected]) | |
# Additions: | |
# 2009 Sept 10: Modified to use Gmail (Daniel Parker <[email protected]>) | |
use Net::SMTP::SSL; |
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
#!/usr/bin/env ruby | |
# mategem (bash command) | |
require 'rubygems' | |
gemname = ARGV[0] | |
paths = $:.to_a.dup | |
begin | |
gem gemname | |
new_paths = $:.to_a.dup - paths |
OlderNewer