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 fetch_data | |
Net::FTP.open(host, username, password) do |ftp| | |
begin | |
ftp.binary = binary | |
if file_name.is_a?(Regexp) | |
files = ftp.nlst.select { |i| i =~ file_name } | |
matching_file = files.pop | |
end | |
if file_newer && (@data_time = ftp.mtime(matching_file)) > file_newer | |
@data = ftp.get(matching_file) |
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 Import | |
module Translation | |
@translators = {} | |
def self.register(name, callable) | |
if callable.respond_to?(:call) | |
@translators[name.to_sym] = callable | |
else | |
raise Exception("Registered translators must be callable") |
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
# Install with: | |
# bash < <(curl -L https://raw.github.com/gist/1855725) | |
# | |
# Reference: http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug | |
echo "Installing ruby-debug with ruby-1.9.3-p0 ..." | |
curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem | |
curl -OL http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem |
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
-- How to map this in Doctrine to have "commentable" entities (subclasses of Commentable) | |
-- associated to many comments? | |
-- These 2 tables are both "commentable" | |
CREATE TABLE IF NOT EXISTS `posts` ( | |
`id` INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, | |
`name` VARCHAR(255) | |
`body` TEXT |
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 SchedulableListener extends MappedEventSubscriber | |
{ | |
// ... | |
public function getRecurrenceRuleClass(SchedulableAdapter $ea, $class) | |
{ | |
return isset($this->configurations['schedulable']['recurrenceRuleClass']) ? | |
$this->configurations['schedulable']['recurrenceRuleClass'] : | |
$ea->getDefaultRecurrenceRuleClass(); | |
} |
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
Generated at Tue Nov 22 16:56:46 -0500 2011 | |
OpenSSL::PKey::RSAError: private key needed.: no start line | |
/usr/lib/ruby/1.8/mixlib/authentication/signedheaderauth.rb:56:in `private_encrypt' | |
/usr/lib/ruby/1.8/mixlib/authentication/signedheaderauth.rb:56:in `sign' | |
/usr/lib/ruby/vendor_ruby/chef/rest/auth_credentials.rb:51:in `signature_headers' | |
/usr/lib/ruby/vendor_ruby/chef/rest.rb:321:in `authentication_headers' | |
/usr/lib/ruby/vendor_ruby/chef/rest.rb:366:in `build_headers' | |
/usr/lib/ruby/vendor_ruby/chef/rest.rb:216:in `api_request' | |
/usr/lib/ruby/vendor_ruby/chef/rest.rb:125:in `post_rest' | |
/usr/lib/ruby/vendor_ruby/chef/api_client.rb:243:in `save' |
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
puts Dir.pwd |
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
resize | |
COLUMNS=181; | |
LINES=63; | |
export COLUMNS LINES; | |
% |
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
diff --cc cookbooks/mysql/metadata.json | |
index 9010798,b3ab7ec..0000000 | |
--- a/cookbooks/mysql/metadata.json | |
+++ b/cookbooks/mysql/metadata.json | |
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
Feature: vagrant box validation | |
As a valid vagrant box | |
I need to comply to a set of rules | |
Scenario: Checking login # /Users/andrew/.rvm/gems/ruby-1.9.2-p180@ops/gems/veewee-0.2.0/lib/veewee/../../validation/vagrant.feature:5 | |
.. When I ssh to "127.0.0.1" with the following credentials: # veewee-0.2.0/validation/features/steps/ssh_steps.rb:56 | |
| username | password | port | | |
| vagrant | vagrant | 7222 | | |
expected no Exception, got #<Net::SSH::AuthenticationFailed: vagrant> (RSpec::Expectations::ExpectationNotMetError) | |
And I run "whoami" # veewee-0.2.0/validation/features/steps/ssh_steps.rb:98 |