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
| \documentclass[a5paper,10pt]{jsbook} | |
| \usepackage[dvipdfmx]{color} | |
| \usepackage[dvipdfmx]{graphicx} | |
| \usepackage{amsmath} | |
| \usepackage{amssymb} | |
| \usepackage{amscd} | |
| \usepackage{euler} | |
| \usepackage{okumacro} | |
| \usepackage{colortbl} | |
| \usepackage{otf} |
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
| #!/usr/bin/env ruby | |
| require 'twitter' | |
| CLIENT = Twitter::REST::Client.new do |config| | |
| config.consumer_key = "XXXXXXXXXXXXXXXXXXXXXXXXX" | |
| config.consumer_secret = "ssssssssssssssssssssssssssssssssssssssssssssssssss" | |
| config.access_token = "0000000-tttttttttttttttttttttttttttttttttttttttttt" | |
| config.access_token_secret = "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy" | |
| 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
| #!/usr/bin/env ruby | |
| # encoding: utf-8 | |
| Dir.glob("source/*.md").each do |md| | |
| open("#{md}.txt", "w") do |wf| | |
| open(md) do |rf| | |
| rf.readlines.each do |line| | |
| if line.match(%r(http://img\.textfile\.org/)) | |
| line.gsub!(%r(http://img\.textfile\.org/), "https://img.textfile.org/") | |
| 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
| <% | |
| COLOR_PRIMARY = '#ab5637' | |
| TWITTER = '@hyuki' | |
| TWITTER_URL = 'http://twitter.com/hyuki' | |
| URL = 'http://note6.hyuki.net/' | |
| TITLE = '数学ガールの秘密ノート/ベクトルの真実' | |
| BACKGROUND_IMAGE = 'http://static.tumblr.com/91187c5df2205978c2937c64fa62d5bc/qcurvlw/K4pnwia5u/tumblr_static_ebhmjmagw5k48cw8oogkow8o4_2048_v2.png' | |
| SHORTCUT_ICON = 'http://33.media.tumblr.com/avatar_f70f97f2c814_128.png' | |
| SHORTCUT_ICON_PRECOMPOSED = 'http://33.media.tumblr.com/avatar_f70f97f2c814_128.png' | |
| BOOK_COLLECTION_TITLE = '数学ガールの秘密ノート' |
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 foo(id) | |
| s = id.to_s | |
| s.sub!(/^(\d\d\d\d)$/, '\1年') | |
| s | |
| end | |
| id = '2016' | |
| foo(id) | |
| puts id #=> 2016年 |
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
| class Fixnum | |
| def to_ss | |
| if self == 0 | |
| "" | |
| elsif self == 1 | |
| "{}" | |
| else | |
| (self - 1).to_ss + ',' + (self - 1).to_s | |
| 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
| N = 2016_06_01 | |
| (1..N).each do |n| | |
| if (N / n) * n == N | |
| puts "#{N} can be divided by #{n}." | |
| end | |
| end | |
| __END__ | |
| 20160601 can be divided by 1. | |
| 20160601 can be divided by 20160601. |
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
| #!/usr/bin/env ruby | |
| DIRECTORY = '/YOUR/PDF/DIR' | |
| keyword = nil | |
| number = nil | |
| if ARGV.length != 1 and ARGV.length != 2 | |
| puts "Usage (1): book keyword" | |
| puts "Example (1): book Galois" | |
| puts "Usage (2): book keyword number" |
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
| set formatexpr="" | |
| set formatprg=/YOUR/BIN/DIR/formatprg.rb |