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 | |
# EXAMPLE RUN: | |
# | |
# ~/Desktop $> ruby file_inventory.rb . .rb m c h a | |
# EXTENSION FILES LINES AVG LINES/FILE | |
# --------------------------------------------------------------------------------- | |
# *.rb 5073 489642 97 | |
# *.m 2619 612648 234 | |
# *.c 107 71519 668 | |
# *.h 5868 256127 44 |
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 'directory_watcher' # gem install directory_watcher | |
require 'net/sftp' # gem install net-sftp | |
SEARCH_DIR = File.expand_path('~/Downloads') | |
SERVER = '' | |
USERNAME = '' | |
PASSWORD = '' | |
REMOTE_DIR = '' |
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
rvm use 1.8.7 | |
ruby taskpaper_git_commit.rb ~/Desktop/TODO.taskpaper |
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
# EXAMPLE RUN: | |
# | |
# ~/Desktop $> ruby file_inventory.rb . .rb m c h a | |
# EXTENSION FILES LINES AVG LINES/FILE | |
# --------------------------------------------------------------------------------- | |
# *.rb 5073 489642 97 | |
# *.m 2619 612648 234 | |
# *.c 107 71519 668 | |
# *.h 5868 256127 44 | |
# *.a 10 62543 6254 |
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
# Author: Allyn Bauer <allyn.bauer@gmail.com> | |
# | |
require 'rubygems' | |
require 'twitter' | |
require 'yaml' | |
require 'ftools' | |
class TwitterBot | |
SAVE_STATE = true # Save the state of the bot between runs | |
CACHE_LOCATION = File.join('.', 'caches') # The directory of the cache file |
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
# In Ruby, modules can be used for two super-sweet purposes. | |
# The first is as a namespace: | |
def swell_message(m) | |
puts m | |
end | |
module Example | |
def self.swell_message(m) | |
puts "(module) #{m}" | |
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
<html> | |
<head> | |
<title>Billy Mays</title> | |
<script> | |
// hack to allow IE to properly channel Billy Mays | |
document.createElement('billy_mays'); | |
</script> | |
<style> | |
billy_mays { |
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 | |
# == Synopsis | |
# This script is only useful for faculty or students at the | |
# University of Northern Iowa, in Cedar Falls Iowa. It's meant | |
# to be copied to a bin directory, made executable and ran with | |
# cron every day/week/whatever. | |
# | |
# == Examples | |
# ruby rod_library_renewer.rb smith 000123456 | |
# ruby rod_library_renewer.rb -d smith 000123456 |
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
filename = 'test.rb' | |
f = File.new(filename) | |
puts f.ctime | |
t = Time.now.to_i | |
File.utime(t,t,filename) | |
puts f.ctime |
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 'mp3info' #http://ruby-mp3info.rubyforge.org/ | |
class String | |
def shift | |
o = self[0,1] | |
self.replace(self[1, length]) | |
o | |
end | |
end |
NewerOlder