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
test |
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
> git | |
git, the filemanager with GNU Interactive Tools, is now called gitfm. | |
If you are looking for git, Linus Torvald's content tracker, install | |
the cogito and git-core packages and see README.Debian and git(7). | |
This transition script will be removed in the debian stable | |
release after etch. | |
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/env ruby | |
require 'rubygems' | |
require 'activerecord' | |
# require 'activesupport' | |
require 'pp' | |
require 'logger' | |
ActiveRecord::Base.establish_connection( | |
:adapter => "mysql", |
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
def name_to_path | |
polish = Hash.new | |
polish["ą"] = "a" | |
polish["ć"] = "c" | |
polish["ę"] = "e" | |
polish["ł"] = "l" | |
polish["ń"] = "n" | |
polish["ó"] = "o" | |
polish["ś"] = "s" | |
polish["ż"] = "z" |
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 AddImgToPortfolios < ActiveRecord::Migration | |
def self.up | |
add_column :portfolios, :img_file_name, :string | |
add_column :portfolios, :img_content_type, :string | |
add_column :portfolios, :img_file_size, :integer | |
add_column :portfolios, :img_updated_at, :datetime | |
end | |
def self.down | |
remove_column :portfolios, :img_file_name |
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
$single_types_available = { 1 => "2", "oki" => 'dupa'}; | |
my ($x,undef) = keys %{$single_types_available}; | |
print "X: $x\n" |
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
oki@nil ~/ruby/ruby_1_9 (svn::trunk/) $ svn info | |
Path: . | |
URL: http://svn.ruby-lang.org/repos/ruby/trunk | |
Repository Root: http://svn.ruby-lang.org/repos/ruby | |
Repository UUID: b2dd03c8-39d4-4d8f-98ff-823fe69b080e | |
Revision: 20387 | |
Node Kind: directory | |
Schedule: normal | |
Last Changed Author: matz | |
Last Changed Rev: 20387 |
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 | |
# sir, avi | |
ARGV[0] || (puts "Use ./#{$0} dir"; exit 0) | |
n = 0 | |
Dir[ARGV[0]+'/*'].sort_by { |f| | |
File.stat(f).mtime | |
}.each { |f| `mv #{f} #{f.gsub(/([^\/])+$/, ('%03d.avi' % n=n+1))}` } |
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 'rexml/document' | |
xml = REXML::Document.new(File.open("list.xml")) | |
puts xml.elements.to_a("//entry").size |
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 = [1,2,3] | |
=> [1, 2, 3] | |
>> b = %w(a b c) | |
=> ["a", "b", "c"] | |
>> x = [a,b] | |
=> [[1, 2, 3], ["a", "b", "c"]] | |
>> x.transpose | |
=> [[1, "a"], [2, "b"], [3, "c"]] | |
>> |
OlderNewer