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
#!/bin/bash | |
if (( $# < 1 )) | |
then | |
script_name=`basename $0` | |
echo "Usage: $script_name <interface_name>" | |
echo " e.g.: $script_name `ifconfig -l -d | cut -f 1 -d ' '`" | |
exit | |
fi |
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
# In Ruby, initialize is not a class method; it can't access | |
# class instance variables. | |
class C | |
@a = 1 | |
def self.a | |
@a | |
end | |
def initialize |
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 Parent | |
def initialize( a, b ) | |
@a = a | |
@b = b | |
end | |
attr_reader :a, :b | |
end | |
class Child < Parent | |
def initialize( *args ) |
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
# Instance methods can only access class-level instance variables via accessor methods (which are themselves class-level methods). | |
# Here's a demonstration of a more complex situation (in which the instance method in question comes from a mix-in module) | |
# that illustrates the same principle. | |
module M | |
def f | |
puts self.class.a | |
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
=begin | |
http://groups.google.com/group/capistrano/msg/9f17c9c7787ac390 | |
Message from discussion deploy:check and config.gem | |
From: Tom Copeland <[email protected]> | |
Date: Thu, 4 Feb 2010 06:57:50 -0500 | |
Local: Thurs, Feb 4 2010 3:57 am | |
Subject: Re: [capistrano] deploy:check and config.gem | |
On Feb 4, 2010, at 6:39 AM, Tom Copeland wrote: |
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
namespace :deploy do | |
def config(key) | |
(@config ||= YAML.load_file("config/deploy.yml").symbolize_keys)[key.to_sym] | |
end | |
# Hooks as needed | |
task :local_before do | |
end |
NewerOlder