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 ruby implementation of python's with statement | |
# | |
# not sure if this is semantically identical, it was meant as a small excercise | |
module WithStatement | |
def with(*objs) | |
raise "no block given" unless block_given? | |
options = objs.unshift! if objs.last.is_a? Hash |
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
module RVideo | |
module Tools | |
class Mp4creator | |
include AbstractTool::InstanceMethods | |
attr_reader :raw_metadata | |
def tool_command | |
'mp4creator' | |
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/env ruby | |
# | |
# Useful if your mp3 player doesn't like fancy long filenames | |
# | |
require 'digest/sha1' | |
Dir.glob("*.mp3") do |f| | |
name = f.downcase.split("."); | |
next if name.length < 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
<?php | |
require('adodbrecord/init.php'); # v0.5 or higher required | |
# CREATE TABLE cars (id INTEGER PRIMARY KEY, | |
# brand VARCHAR(50), | |
# color VARCHAR(50), | |
# destination VARCHAR(50) | |
# ) | |
require_once("AdoDBRecord://Car_Base"); |
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 | |
class Proc | |
def ===(*parameters) | |
self.call(*parameters) | |
end | |
end | |
sunday = Proc.new { |time| time.wday == 0 } | |
monday = Proc.new { |time| time.wday == 1 } |
NewerOlder