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
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
-- 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
# 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
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
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
#!/usr/bin/env ruby | |
#^syntax detection | |
site 'http://community.opscode.com/api/v1' | |
cookbook 'application_nginx' | |
cookbook 'application_ruby' | |
cookbook 'apt' | |
cookbook 'git' | |
cookbook 'imagemagick' |
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 PostsController < ApplicationController | |
caches_page :index | |
def index | |
render text: "html!" | |
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 ArticlesController < ActionController::Base | |
def show | |
@article = Article.find(params[:id]) | |
# ... bunch of stuff to set up template display | |
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
# Regex with two named captures both named "word" | |
r = %r{ | |
(?<word>[a-z]+)\s+ | |
(?<word>[a-z]+) | |
}xi | |
m = r.match("one two") | |
# => #<MatchData "one two" word:"one" word:"two"> | |
m.captures |