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
# This is ~/.ssh/config | |
# For all hosts | |
ServerAliveInterval 30 |
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
module Subject | |
attr_reader :observers | |
def subscribe_observer(observer) | |
@observers ||= [] | |
@observers << observer | |
end | |
def unsubscribe_observer(observer) | |
@observers.delete(observer) |
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
select a.TABLESPACE_NAME, | |
a.BYTES bytes_used, | |
b.BYTES bytes_free, | |
b.largest, | |
round(((a.BYTES-b.BYTES)/a.BYTES)*100,2) percent_used | |
from | |
( | |
select TABLESPACE_NAME, | |
sum(BYTES) BYTES | |
from dba_data_files |
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
require "rspec" | |
class Cell | |
attr_accessor :world, :x, :y | |
def initialize(world, x=0, y=0) | |
@world, @x, @y = world, x, y | |
world.cells << self | |
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
class Thing | |
def do_something | |
puts "a" | |
end | |
end | |
thing = Thing.new | |
def thing.do_something | |
puts "b" | |
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
class Module | |
def attr_create(*symbols) | |
symbols.each do |symbol| | |
class_eval("def #{symbol}; @#{symbol}; end;") | |
class_eval("def #{symbol}=(value); @#{symbol} = value; end;") | |
end | |
end | |
end | |
class A |
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 Class | |
def method_missing(name, *args) | |
name = name.to_s | |
if name =~ /this/ | |
name["this_"] = "" | |
eval("@#{name}") | |
end | |
end | |
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
class MyOpenStruct | |
def initialize | |
@attributes = {} | |
end | |
def method_missing(name, *args) | |
attribute = name.to_s | |
if attribute =~ /=$/ | |
@attributes[attribute.chop] = args[0] | |
else |
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
var = "foo" |
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
module Test | |
def class_method | |
"class method" | |
end | |
end | |
class A | |
extend Test | |
end |