Skip to content

Instantly share code, notes, and snippets.

View iorionda's full-sized avatar

Iori ONDA iorionda

  • Freelance
  • Tokyo/Japan
View GitHub Profile
# -*- coding: utf-8 -*-
require 'active_support/core_ext/string/strip'
html = <<-EOS.strip_heredoc
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<meta content='width=device-width; initial-scale=1.0; maximum-scale=1.0;' name='viewport'>
<title>Shift-JISのHTMLメール</title>
#!/bin/env ruby
# -*- coding: utf-8 -*-
# prowl_notification.rb
require 'prowl'
KEY_TITLE = 'PROWL_NOTICE_TITLE'
KEY_DESC = 'PROWL_NOTICE_DESC'
API_KEY = 'PROWL_API_KEY'
@iorionda
iorionda / gist:5502060
Last active December 16, 2015 21:49
bundle install に失敗する
% rbenv exec bundle install --path=vendor/bundle                                                                                                              
Fetching source index from http://rubygems.org/
Using rake (10.0.3) 
(中略)
Using debugger-ruby_core_source (1.1.5) 
Installing debugger-linecache (1.1.2) 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /usr/local/opt/rbenv/versions/1.9.3-p392/bin/ruby extconf.rb 
#!/usr/local/opt/rbenv/shims/ruby
# -*- coding: utf-8 -*-
require 'nokogiri'
str =<<HTML
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
@iorionda
iorionda / ginger.md
Last active December 16, 2015 19:39
SublimeText2 の拡張作れないかなと思って調べてる。

修正の入る方

% curl 'http://services.gingersoftware.com/Ginger/correct/json/GingerTheText?&apiKey=6ae0c3a0-afdc-4532-a810-82ded0054236&lang=US&clientVersion=2.0&text=helllo' | jq "."
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   334  100   334    0     0    508      0 --:--:-- --:--:-- --:--:--   509
#!/usr/bin/env ruby
require 'optparse'
opts = OptionParser.new
opts.on('--noop', 'dry-run mode') { |v| $noop = true }
opts.parse!
`git branch -r`.each_line do |branch|
branch.strip!.chomp!
next if branch =~ %r![^/]+/master!
@iorionda
iorionda / request.rb
Created March 21, 2013 14:34
うわー
#!/usr/local/env ruby
# -*- coding: utf-8 -*-
require 'rubygems'
require 'typhoeus'
request = []
hydra = Typhoeus::Hydra.new(:max_concurrency => 32)
1000.times.map do
# -*- coding:utf-8 -*-
require 'benchmark'
def gsub_check
10000.times do |n|
" ".gsub(/ /, " ")
end
end
def gsub_check_2
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 41392c5..d9d4595 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -29,6 +29,13 @@ WebMock.allow_net_connect! #スタブ未設定URLへのアクセスを許可す
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
+class String
+ def colorize(color_code); "\e[#{color_code}m#{self}\e[0m"; end
@iorionda
iorionda / gist:5087915
Created March 5, 2013 04:07
./bin/hubot -a skype が動かない。
[Tue Mar 05 2013 12:45:38 GMT+0900 (JST)] ERROR Cannot load adapter skype - Error: Cannot find module 'hubot'
TypeError: Cannot call method 'on' of null
at Object.<anonymous> (/Users/ONDA/work/hubot/bin/hubot:136:19)
at Object.<anonymous> (/Users/ONDA/work/hubot/bin/hubot:140:4)
at Module._compile (module.js:449:26)
at Object.exports.run (/Users/ONDA/.nodebrew/node/v0.8.18/lib/node_modules/coffee-script/lib/coffee-script/coffee-script.js:82:25)
at compileScript (/Users/ONDA/.nodebrew/node/v0.8.18/lib/node_modules/coffee-script/lib/coffee-script/command.js:177:29)
at fs.stat.notSources.(anonymous function) (/Users/ONDA/.nodebrew/node/v0.8.18/lib/node_modules/coffee-script/lib/coffee-script/command.js:152:18)
at fs.readFile (fs.js:176:14)
at Object.oncomplete (fs.js:297:15)