This file contains hidden or 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 Controller | |
attr_reader :tag | |
def initialize | |
@tag = "Controller" | |
@window = Window.new(self) | |
@window.show | |
hello | |
hello_again | |
end |
This file contains hidden or 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 | |
# Usage: | |
# $ ./script/railssh | |
APP_PATH = File.expand_path('../../config/application', __FILE__) | |
require File.expand_path('../../config/boot', __FILE__) | |
require APP_PATH | |
Rails.application.require_environment! | |
module Kernel |
This file contains hidden or 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
# Everything you need to do to get started with Rails 2.3.8 | |
# | |
# As of June 14th, 2010 @ 2:30 p.m. MST | |
# | |
# This gist now features instructions to get Rails 3 up and running with: | |
# - Ruby 1.8.7-p174 | |
# - Bundler 0.9.26 | |
# - Cucumber 0.8.0 | |
# - Rspec 1.3.0 + Rspec-Rails 1.3.2 | |
# - RVM |
This file contains hidden or 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
t = Thread.start do | |
l = '/ - \ |'.split | |
print "\e[?25l" | |
loop do | |
c = l.shift | |
print "\r#{c}" | |
STDOUT.flush | |
sleep 0.1 | |
l.push c | |
end |
This file contains hidden or 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
# Put this file in your config/initializers directory and behold a tastier auto_link! | |
module ActionView | |
module Helpers | |
module TextHelper | |
# Use auto_link and friends from Rails 3. They do the right thing (tm). | |
remove_const(:AUTO_LINK_RE) if defined?(AUTO_LINK_RE) | |
AUTO_LINK_RE = %r{ | |
( https?:// | www\. ) |

This file contains hidden or 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
# @settings and anything in it could be nil or blank at any time | |
def get_backlog_issues(exclude_ids=[]) | |
return [[]] unless @settings.present? && | |
@settings['panes'].present? && | |
@settings['panes']['backlog'].present? && | |
@settings['panes']['backlog']['status'].present? && | |
@settings['panes']['backlog']['limit'].present? | |
# ... |
This file contains hidden or 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 mode(arr=[]) | |
hsh = arr.inject(Hash.new(1)) { |hash, item| hash[item] += 1; hash } | |
max = hsh.values.max | |
hsh.inject([]) { |arr, item| arr << item[0] if item[1] >= max; arr} | |
end | |
p mode %w(a b a a b c dd e e e) # ["e", "a"] | |
p mode %w(a b a a b c dd e e) # ["a"] | |
p mode %w(snowboarding is more than fun. super fun.) # ["fun."] |
This file contains hidden or 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 GitProductive | |
attr_accessor :directory, :lines, :commits | |
def initialize(directory = Dir.pwd) | |
raise "#{directory} is not a git repository" unless Dir.entries(directory).include?(".git") | |
@directory = directory | |
@lines, @commits = 0, 0 | |
end | |
def check!(duration = "1 days") |
This file contains hidden or 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 | |
Main { | |
Home = File.expand_path(ENV["HOME"] || ENV["USERPROFILE"] || "~") | |
Basedir = File.join(Home, "mp3") | |
Threads = 8 | |
description <<-txt | |
mp3scrape will scour any url for it's mp3 content - the script mirrors, | |
never downloading the same file twice. it does not, however, crawl a |
NewerOlder