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
module GemDepPatch_ | |
def to_specs | |
#super.select {|spec| spec.full_name != 'activesupport-5.1.2' } | |
super.sort_by {|spec| spec.activated? ? -1 : 1 } | |
end | |
end | |
Gem::Dependency.prepend(GemDepPatch_) |
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
# Generate files: | |
# | |
# ``` | |
# ruby client_auth_test.rb dir | |
# ``` | |
# | |
# Run Apache HTTP server: | |
# | |
# ``` | |
# apachectl -d dir -f httpd.conf -X |
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 'rbconfig' | |
require 'shellwords' | |
require 'yaml' | |
require 'tmpdir' | |
def get_output(cmd) | |
IO.popen(cmd, 'r', &:read) | |
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/ruby | |
require 'origami' | |
include Origami | |
pdf = PDF.read(ARGV.first) | |
pdf.pages.each do |page| | |
xobjs = page.Resources[:XObject] | |
xname = xobjs.keys.first | |
obj = xobjs[xname].solve | |
open("new-image.jpg", "r") do |i| |
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 'rubygems' | |
require 'fileutils' | |
require 'open-uri' | |
require 'pathname' | |
task :bundler do | |
require 'bundler/setup' | |
Bundler.require(:default) | |
require 'jekyll' | |
require './_libs/post_editor' |
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 'tilt' | |
module Sprockets | |
class RemoveFontFaceExceptTheFirstOne < Tilt::Template | |
def prepare | |
end | |
def evaluate(context, locals, &block) | |
found = false | |
data.gsub(/^@font-face {[^}]*}/) do |
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 | |
# | |
# Groongaの類似文書検索機能を使って類似記事を抽出する。 | |
require 'tmpdir' | |
require 'groonga' | |
module Jekyll | |
class Site | |
alias process_without_groonga process |
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 | |
# encoding: utf-8 | |
require 'mini_magick' | |
require 'origami' | |
include Origami | |
def fixup!(pdf) | |
pdf.root_objects.each do |obj| | |
next unless obj.is_a?(Graphics::ImageXObject) |
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
# based lib/jekyll/site.rb of jekyll 0.11.0 | |
module Jekyll | |
class Site | |
class PostList < Array | |
def sort | |
self.class.new(super) | |
end | |
def next(obj) | |
setup_index_cache |
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
# based lib/jekyll/site.rb of jekyll 0.11.0 | |
module Jekyll | |
class Site | |
class PostList < Array | |
def index(obj) | |
unless @hash | |
@hash = {} | |
each_with_index do |post, idx| | |
@hash[post.object_id] = idx | |
end |