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
start = element ydml { Block* } | |
Block = Paragraph* & Center* & Left* & Right* & Quote* & Hasen* | |
Paragraph = Inline + | |
Inline = Large|Small|Bold|Image|Ruby|text | |
Center = element center { Inline+ } | |
Left = element left { Inline+ } | |
Right = element right { Inline+ } | |
Quote = element quote { Inline+ } | |
Hasen = element hasen { empty } |
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
require 'uri' | |
class DenshoConv | |
attr_accessor :file_prefix, :file_suffix, :title, :stylesheets, :count, :toc, :count_format, :replace_url, :outer_div_class | |
def init_default_filters | |
before_filter do | |
|text| | |
if @replace_url | |
URI.extract(text, ['http', 'https']).each { |url| |
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
{ | |
"name": "ChromeExtensionSolver", | |
"version": "1.0", | |
"description": "Open the first card and show background color of the card.", | |
"content_scripts": [ | |
{ | |
"matches": [ | |
"http://gdd-2011-quiz-japan.appspot.com/webgame/problem*" | |
], | |
"js": [ |
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
gets.to_i.times do | |
gets | |
nums = gets.split(' ').map(&:to_i) | |
queue = [[nums, 0]] | |
while !queue.empty? | |
node, ct = queue.shift | |
if (node.all? { |x| x % 5 == 0}) | |
puts ct + 1 | |
break | |
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
package main | |
import ( | |
"fmt" | |
"io" | |
"strings" | |
"image/png" | |
) | |
func CountColor(pngdata io.Reader) int { |
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
require 'pp' | |
class Bar | |
attr_accessor :foo_bars | |
def initialize(&block) | |
@foo_bars = [] | |
yield self | |
end | |
def foo_bar(&block) |
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 -*- | |
# GEPUB::Builder example. | |
require 'ruby gem' | |
require 'gepub' | |
builder = GEPUB::Builder.new { | |
# In the root block, you can define metadata. | |
# You can define title, creator(s), contributor(s), publisher(s), date, unique_identifier, identifier, language. | |
# Title can be specified with title, subtitle, collection, short_title, expanded_title, edition. | |
# You can also define description, format, relation, right, source, subject, type. |
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
$ gem install nokogiri | |
$ ruby zen-to-han.rb < source.html > destination.html |
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
text =<<EOF | |
speak(Alice): Alice is speaking. | |
speak(Bob): and this is Bob. | |
EOF | |
document = NoraMark::Document.parse(text) | |
document.add_transformer(generator: :html) do | |
modify "speak" do | |
@node.name = 'p' | |
@node.prepend_child inline('span', @node.parameters[0], classes: ['speaker']) |
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
# Markdown-ish heading with explicit setion boundary | |
--- | |
lang: ja | |
title: test title | |
stylesheets: css/normalize.css, css/main.css | |
--- | |
=: this is the first heading |
OlderNewer