Skip to content

Instantly share code, notes, and snippets.

Kensuke Nagae kyanny

Block or report user

Report or block kyanny

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kyanny
kyanny / user.css
Created Jan 26, 2018
GitHub通知で選択中の行を強調する
View user.css
@-moz-document url-prefix("https://github.com/notifications"), url-prefix("https://github.com/notifications/participating"), regexp("https://github.com/.*/notifications.*") {
.list-group-item.navigation-focus {
outline: 1px black dashed;
}
}
View faraday_proxy.rb
#!/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
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">
@kyanny
kyanny / bad.rb
Last active Aug 24, 2017
NameError: uninitialized constant ActiveModel::Serializers::Xml in MongoMapper
View bad.rb
require 'active_model'
require 'mongo_mapper'
MongoMapper.database = 'testing'
class Foo
include MongoMapper::Document
end
Foo.destroy_all
@kyanny
kyanny / x2str.rb
Created Aug 12, 2017
\xXX 形式の文字列を UTF-8 とみなしてデコードする
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]
@kyanny
kyanny / str2x.rb
Created Aug 12, 2017
文字列を \xXX 形式に変換する
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
You can’t perform that action at this time.