Skip to content

Instantly share code, notes, and snippets.

Avatar

Masanori Kado kdmsnr

View GitHub Profile
View 小学生が見るべき映画.md

小学生が見るべき映画

ディズニー/Pixar

  • アナと雪の女王
  • ウォーリー
  • Mr.インクレディブル
  • インサイドヘッド
  • ファインディング・ニモ
  • ベイマックス
  • モンスターズ・インク
View prefer-kindle-device.js
window.addEventListener("load", main, false);
function main(e) {
const jsInitCheckTimer = setInterval(jsLoaded, 1000);
function jsLoaded() {
var t = document.querySelector(".ebookBuyboxDeliverToDropdown").children[1];
if (t != null) {
clearInterval(jsInitCheckTimer);
var c = t.parentNode.children;
for (var i = 0; i < c.length; i++) {
View slack-translator-bot.js
// inspired from:
// https://gist.github.com/masuidrive/0bea937bcaf12bc94e7fba8acf13382a
// ## Go to https://api.slack.com/
// * Create your app.
// * Create "Bot User".
// * Go to "OAuth Tokens & Redirect URLs" and copy the Access Token.
// * Set the permission of "chat:write:bot" to the bot.
// ## Go to https://www.google.com/script/start/
@kdmsnr
kdmsnr / howm-hastag.el
Created Aug 22, 2018
howmでハッシュタグをaction-lockにする
View howm-hastag.el
(defun my/action-lock-search-hashtag (hashtag)
(howm-search hashtag t))
(setq action-lock-default-rules
(cons (action-lock-general 'my/action-lock-search-hashtag "^#[^ #]+$" 0)
action-lock-default-rules))
View memo.el
(defun memo-create()
(interactive)
(let ((memo-name (format-time-string "%Y-%m-%d-%s")))
(find-file (concat "~/Dropbox/memo/" memo-name ".md"))))
(defun memo-search()
(interactive)
(setq q (read-string "grep word: "))
(ag-regexp q "~/Dropbox/memo/")
(select-window ; select ag buffer
(car (my/get-buffer-window-list-regexp "^\\*ag "))))
View inline_dl.rb
def inline_dl(line)
dl = ""
dl << "<dl>"
line.scan(/\[.+?\][^\[]+/).each do |item|
dt, dd = item.scan /[^\[\]]+/
dl << "<dt>#{dt}</dt>"
dl << "<dd>#{dd}</dd>"
end
dl << "</dl>"
dl
View gist:01af2946e63755b88a89
/Users/xxx/.nodebrew/node/v5.8.0/lib/node_modules/textlint/lib/task/textlint-core-task.js:13
f (typeof superClass !== "function" && superClass !== null) { throw new TypeEr
^
TypeError: Super expression must either be null or a function, not object
at _inherits (/Users/kdmsnr/.nodebrew/node/v5.8.0/lib/node_modules/textlint/lib/task/textlint-core-task.js:13:113)
at /Users/kdmsnr/.nodebrew/node/v5.8.0/lib/node_modules/textlint/lib/task/textlint-core-task.js:38:5
at Object.<anonymous> (/Users/kdmsnr/.nodebrew/node/v5.8.0/lib/node_modules/textlint/lib/task/textlint-core-task.js:160:3)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
View review-imenu.el
(defun review-create-imenu-index ()
(let ((index)
(pattern "^\=+\\({.+}\\)? "))
(save-excursion
(goto-char (point-min))
(while (re-search-forward pattern (point-max) t)
(push (cons (buffer-substring-no-properties (line-beginning-position) (line-end-position))
(match-beginning 0)) index))
(nreverse index))))
@kdmsnr
kdmsnr / gist:c49487af5e83ac6f277b
Created Jan 29, 2015
metaprogramming ruby sample code: using.rb
View gist:c49487af5e83ac6f277b
module Kernel
def using(resource)
begin
yield
ensure
resource.dispose
end
end
def using2(resource)
View review-ext.rb
# -*- coding: utf-8 -*-
ReVIEW::Compiler.defblock :tsv, 0..2, true
module ReVIEW
class Builder
# //tsv[ファイル名][キャプション]
def tsv(lines, id, caption = nil)
lines = File.open(id)
table(lines, id, caption)
end