View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
View bad.rb
require 'active_model'
require 'mongo_mapper'
MongoMapper.database = 'testing'
class Foo
include MongoMapper::Document
end
Foo.destroy_all
View x2str.rb
#!/usr/bin/env ruby
def x2str(x)
# assume x is hex format of UTF-8 string, so that process 3 bytes at once
x.gsub(/\\x(..)\\x(..)\\x(..)/) {
["#{$1}#{$2}#{$3}"].pack("H*")
}
end
x = ARGV[0]
View str2x.rb
#!/usr/bin/env ruby
def str2x(str)
str.unpack("H*").first.scan(/[0-9a-z]{2}/).map{ |x| '\x' + x.upcase }.join
end
str = ARGV[0]
unless str
puts <<USAGE
Usage: ruby #{$0} STRING
View config.yaml
console_palette: solarized_dark
View mm.rb.diff
diff --git a/mongomapper-inherit-one/mm.rb b/mongomapper-inherit-one/mm.rb
index b7cf1e5..5b727a2 100644
--- a/mongomapper-inherit-one/mm.rb
+++ b/mongomapper-inherit-one/mm.rb
@@ -29,6 +29,7 @@ class Membership
end
class WrapUser < User
+ one :membership, foreign_key: :user_id
end
View mm.rb
gem 'activemodel', '4.2.7.1'
require 'active_model'
require 'mongo_mapper'
require 'byebug'
require 'logger'
logger = Logger.new(STDOUT)
logger.level = :info
MongoMapper.setup(
{
View mm.rb
gem 'activemodel', '4.2.7.1'
require 'active_model'
require 'mongo_mapper'
require 'byebug'
require 'logger'
logger = Logger.new(STDOUT)
logger.level = :info
MongoMapper.setup(
{