This file contains 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
# | |
# ruby implementation of | |
# https://github.com/domnikl/DesignPatternsPHP/tree/master/Structural/Adapter | |
# for reno developers meetup 2014-07-28 | |
# https://github.com/renodevelopers/meetups/issues/26 | |
# | |
module DesignPatterns | |
module Structural |
This file contains 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
{ | |
"schema": { | |
"description": "Schema for Inspections. Represents top-level inspection data.", | |
"attributes": { | |
"id": "Surrogate key", | |
"date": "Date of inspection", | |
"links": { | |
"inspection": "Link to inspection data" | |
} | |
} |
This file contains 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
# | |
# usage: ruby -Imechanize extract_facilities.rb | |
require "mechanize" | |
class FacilityScraper | |
def self.call | |
new.call | |
end |
This file contains 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
$ whois johnga.lt | |
% Hello, this is the DOMREG whois service. | |
% | |
% By submitting a query you agree not to use the information made | |
% available to: | |
% - allow, enable or otherwise support the transmission of unsolicited, | |
% commercial advertising or other solicitations whether via email or | |
% otherwise; | |
% - target advertising in any possible way; | |
% - to cause nuisance in any possible way to the registrants by sending |
This file contains 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
// example usage: | |
// <script type="text/javascript" src="redirector.js"></script> | |
// | |
// <script type="text/javascript"> | |
// (function (global) { | |
// redir = global.Redirector; | |
// | |
// redir.width = 1400; // optional | |
// redir.base_url = "http://example.com"; | |
// redir.redirect(); |
This file contains 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
$ cat bitizen.rb | |
module BitTypes | |
def bit_types | |
%w[ Food Service Recreation Retail Creative ] | |
end | |
end | |
class Job | |
include BitTypes |
This file contains 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
$ ./script/server | |
=> Booting Mongrel | |
=> Rails 2.3.5 application starting on http://0.0.0.0:3000 | |
/usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:in `requirement': undefined local variable or method `version_requirements' for #<Rails::GemDependency:0xf6e64a78> (NameError) | |
from /usr/local/lib/site_ruby/1.8/rubygems.rb:254:in `activate' | |
from /usr/local/lib/site_ruby/1.8/rubygems.rb:1204:in `gem' | |
from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:73:in `add_load_paths' | |
from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:301:in `add_gem_load_paths' | |
from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:301:in `each' | |
from /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:301:in `add_gem_load_paths' |
This file contains 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/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/postgresql_adapter.rb:1029: [BUG] rb_gc_mark(): unknown data type 0x34(0xa9405d8) non object | |
ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux] | |
Aborted |
This file contains 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
/etc/nginx# cat canonical_hostname | |
if ($host != $server_name) { | |
rewrite ^(.*)$ $scheme://$server_name$1 permanent; | |
} |
This file contains 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
# config/initializers/datamapper.rb | |
# | |
# configuring DataMapper w/ Rails (including setting up logging) | |
require 'dm-core' | |
# http://datamapper.rubyforge.org/dm-core/DataMapper/Logger.html | |
# have to setup logger *before* #setup | |
DataMapper.logger = RAILS_DEFAULT_LOGGER | |
# http://datamapper.rubyforge.org/dm-core/DataMapper.html | |
hash = YAML.load(File.new(File.expand_path("config/database.yml", Rails.root))) |
NewerOlder