This file contains hidden or 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
module Luhn | |
CODE_0 = "0".ord | |
CODE_9 = "9".ord | |
CODE_A = "A".ord | |
CODE_Z = "Z".ord | |
def self.add(data) | |
return data + get_char(data) | |
end |
This file contains hidden or 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
def open_uri(uri, options = {}, &block) | |
uri = URI.parse(uri) until URI === uri | |
proxy = uri.find_proxy | |
unless proxy.nil? | |
if proxy.user.nil? | |
options[:proxy] = proxy | |
else | |
options[:proxy_http_basic_authentication] = [proxy, proxy.user, proxy.password] | |
end | |
end |
This file contains hidden or 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/lib/gist.rb b/lib/gist.rb | |
index d0be256..2274d7e 100644 | |
--- a/lib/gist.rb | |
+++ b/lib/gist.rb | |
@@ -33,11 +33,17 @@ module Gist | |
PROXY = URI(ENV['HTTPS_PROXY']) | |
elsif ENV['HTTP_PROXY'] | |
PROXY = URI(ENV['HTTP_PROXY']) | |
+ elsif ENV['http_proxy'] | |
+ PROXY = URI(ENV['http_proxy']) |
This file contains hidden or 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
var util = require('util'); | |
var url = require('url'); | |
var http = require('http'); | |
function download(u) { | |
u = url.parse(u) | |
var client = http.createClient(u.port || 80, u.hostname); | |
var req = client.request('GET', u.pathname, {host: u.hostname}); | |
req.end(); | |
req.on('response', function(res) { |
This file contains hidden or 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
#!/bin/bash | |
# コマンドの説明(ヘルプ)の文章をそれなりに解釈して、 | |
# 引数のオプション解析を行うbash用関数 | |
# | |
# 詳しくは後ろの方にある使用例を参照のこと。 | |
function optparse() { | |
if [[ ! $optparse_prefix ]]; then | |
optparse_prefix="opt_" | |
fi |
This file contains hidden or 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
@ECHO OFF | |
REM プロジェクトのルートディレクトリに移動する。 | |
REM PUSHDしてあるので、元のディレクトリに戻りたい場合はPOPDすればよい。 | |
REM | |
REM ルートディレクトリの定義(上位ほど優先順位高) | |
REM .projectファイルがある(Eclipseのプロジェクトルート) | |
REM .gitディレクトリがある(gitのルート) | |
REM .svnディレクトリがあるtrunkディレクトリ(svnのルート) | |
PUSHD . |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
# earthquake.gem plugin | |
# screen cleaer command | |
Earthquake.init do | |
command :clear do | |
system "clear" | |
end | |
help :clear, "clear screen" | |
end |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
# earthquake.gem plugin | |
# expand url | |
require 'open-uri' | |
require 'uri' | |
require 'net/http' | |
def get_location(url) | |
begin | |
url = URI.parse(url.to_s) |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
# earthquake.gem plugin | |
# insert maker | |
Earthquake.init do | |
cfg = config[:marker] || {} | |
command :marker do | |
input(":marker #{cfg[:comment]}") | |
end |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
# earthquake.gem plugin | |
# add url to Pocket(http://getpocket.com) | |
require 'uri' | |
require 'open-uri' | |
Earthquake.init do | |
cfg = config[:pocket] || {} | |
command :pocket do |m| | |
pocket_uri = URI.parse('https://readitlaterlist.com/v2/add') |
OlderNewer