Skip to content

Instantly share code, notes, and snippets.

doctype
html
head
meta(charset="UTF-8")
script(src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.17/angular.min.js")
body
div(ng-app,ng-init="qty=1;cost=2")
b Invoice:
div Quantity:
input(type="number", ng-model="qty")
@higuma
higuma / image2jpg.rb
Created September 12, 2016 11:08
Convert multi-format images to JPG (using ImageMagick on ruby)
#!/usr/bin/env ruby
# Convert non-destructive format(PNG/BMP/TIFF) images to JPEG
# (for Windows, runs on git bash only)
#
# Requires ImageMagick: set correct ImageMagick path as below
# (e.g. convert.exe collides with Windows system command)
IM_PATH = 'C:/usr/ImageMagick'
IM_CONVERT = "#{IM_PATH}/convert"
require 'net/http'
URI_BASE = 'https://www.marutsu.co.jp/contents/shop/marutsu/mame'
EXT = ['html', 'htm', 'pdf']
NUMBER_RANGE = 1..220 # max = 205?
def https_request(uri)
uri = URI uri
Net::HTTP.start uri.host, uri.port, use_ssl: uri.scheme == 'https' do |http|
response = http.request Net::HTTP::Get.new(uri)
@higuma
higuma / mnist.go
Last active August 25, 2021 00:48
MNIST database reader with Golang
// MNIST database reader
// http://yann.lecun.com/exdb/mnist/
package mnist
import (
"fmt"
"os"
"path/filepath"
)
#!/usr/bin/env ruby
# git-id: calculates the git ID (sha-1) with the specified object type
require 'optparse'
require 'openssl'
type = 'blob' # as default
opt = OptionParser.new
@higuma
higuma / httpd
Created June 13, 2022 14:00
HTTP dev server with ruby webrick
#!/usr/bin/env ruby
require 'optparse'
require 'webrick'
# Add additional MIME types here
WEBrick::Config::HTTP[:MimeTypes].update({
'wasm' => 'application/wasm'
})
#!/usr/bin/env ruby
# Recursive line/word/byte counter
require 'find'
require 'fileutils'
ARGV.push '.' if ARGV.empty?
total_lines = total_words = total_bytes = 0
@higuma
higuma / markdown-escapes.rb
Last active August 26, 2022 02:40
Backslash escapes in GitHub Markdown (source code)
# Render markdown-escapes.md
N_COL = 16
puts "# Backslash escapes in Markdown"
puts
puts "Backslash escape effects for all ASCII printable characters (→ [source](https://gist.github.com/higuma/15de141310855a8f654792046dca5c50))"
puts
puts "| U+ |" + (0...N_COL).inject('') {|row, col| row + sprintf(" %X |", col) }
puts (0..N_COL).inject('|') {|row, _| row + ' :-: |' }
@higuma
higuma / markdown-escapes.md
Last active August 26, 2022 02:40
Backslash escapes in GitHub Markdown

Backslash escapes in Markdown

Backslash escape effects for all ASCII printable characters (→ source)

U+ 0 1 2 3 4 5 6 7 8 9 A B C D E F
0020 \
\
\!
!
\"
"
\#
#
\$
$
\%
%
\&
&
\'
'
\(
(
\)
)
\*
*
\+
+
\,
,
\-
-
\.
.
\/
/
0030 \0⁠\0 \1⁠\1 \2⁠\2 \3⁠\3 \4⁠\4 \5⁠\5 \6⁠\6 \7⁠\7 \8⁠\8 \9&
@higuma
higuma / markdown-preview-output-deference.md
Last active August 11, 2022 14:19
GistのPreviewとOutputで結果が異なるMarkdown文書の例

(2022-08-11現在) 次のMarkdown文書はPreviewとOutputで結果が異なる。

\[これはリンクではない、しかしリンク先に注意](https\://www\.example\.com)

[これはリンクではない、しかしリンク先に注意](https://www.example.com)

https://...の部分は次のように処理される。