- GitHub Staff
- https://bento.me/kyanny
- @kyanny
- in/kyanny
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/bin/env ruby | |
require 'faraday' | |
require 'logger' | |
url = 'https://requestb.in/1fkjebe1' | |
proxy = ENV.fetch('PROXY') | |
logger = Logger.new($stdout) | |
conn = Faraday.new do |faraday| | |
faraday.response :logger, logger |
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
hello |
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
<!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"> |
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
require 'active_model' | |
require 'mongo_mapper' | |
MongoMapper.database = 'testing' | |
class Foo | |
include MongoMapper::Document | |
end | |
Foo.destroy_all |
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/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] |
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/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 |
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
citylots.json |
This file has been truncated, but you can view the full file.
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
console_palette: solarized_dark | |
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
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 |