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 | |
# 空のディレクトリの中に空のファイルを作る | |
# gitなどのお供に | |
require 'pathname' | |
if ARGV[0] =~ /-{1,2}h+/ | |
puts 'example) ruby mkblank.rb -v /path/to/dir filename' | |
exit | |
end | |
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 | |
# Webページからリンクされているjpg, gif, pngをカレントディレクトリにダウンロード | |
require 'rubygems' | |
require 'open-uri' | |
require 'nokogiri' | |
require 'uri' | |
urls = ARGV | |
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
#!/opt/local/bin/perl | |
# Webページからリンクの張られた画像をカレントディレクトリにダウンロード(perl+regexp版) | |
use strict; | |
use warnings; | |
require LWP::UserAgent; | |
my @urls = @ARGV; | |
my $ua = LWP::UserAgent->new; |
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 "rubygems" | |
require "open-uri" | |
require "mechanize" | |
module Sitemap | |
class UriList | |
def initialize |
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 'nokogiri' | |
require 'open-uri' | |
require 'pathname' | |
url = ARGV[0] | |
dir = Pathname(ARGV[1]) | |
unless dir.exist? | |
Dir::mkdir dir | |
end |
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
.bundle/ | |
bundle/ |
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 'pp' | |
require 'pathname' | |
resize_command = 'sips -z 34 34 --out out/%2$s %1$s' | |
copy_command = 'cp %s out/%s' | |
Pathname.glob('./*').sort.each_with_index do |path, idx| | |
next unless path.to_s.match(/png$/) | |
system(copy_command % [path.to_s, idx.to_s+'@2x.png']) | |
system(resize_command % [path.to_s, idx.to_s+'.png']) |
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
# coding: utf-8 | |
puts 'gist貼れればOKです!' |
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
# encoding: utf-8 | |
module Lokka | |
module Before | |
def self.registered(app) | |
app.before do | |
# 追加 | |
if request.host == '223soft.net' || request.host == 'www.223soft.net' | |
redirect 'http://blog-223soft.heroku.com'+request.path, 301 | |
end | |
# /追加 |
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 'sinatra/base' | |
# app.rb で register Sinatra::QueryReporter | |
module Sinatra | |
module QueryReporter | |
def self.registered(app) | |
query_count = 0 | |
subscriber = '' | |
app.before do |
OlderNewer