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
;; OS で直接開きたいファイルかどうかを判定する | |
(defun os-open-file-p (file) | |
(if (file-regular-p file) | |
(let ((ext (file-name-extension file)) | |
;; OS で起動したいファイルの拡張子一覧 | |
(os-open-file-suffixes '("doc" "docx" | |
"xls" "xlsx" | |
"ppt" "pptx" | |
"mdb" "mdbx" | |
"vsd" "vdx" "vsdx" |
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
#how to use in template | |
# | |
#{{ page.tag }}'s post' | |
#<a href="{{site.url}}{{ page.tag_previous.url }}">« {{ page.tag_previous.title }}</a> | |
#<a href="{{site.url}}{{ page.tag_next.url }}">{{ page.tag_next.title }} »</a> | |
# | |
module Jekyll | |
class TagAwarePreviousNextGenerator < Generator | |
safe true |
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
;; @original [日付に対する加算 | 逆引きScheme](http://tips.cddddr.org/scheme/index.cgi?%e6%97%a5%e4%bb%98%e3%81%ab%e5%af%be%e3%81%99%e3%82%8b%e5%8a%a0%e7%ae%97) | |
(use srfi-19) | |
;; 日付 date の seconds 秒後の日付を返す。閏秒は考えない。 | |
(define (date-mod-second date seconds) | |
(time-utc->date | |
(add-duration (date->time-utc date) | |
(make-time time-duration 0 seconds)))) |
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
(defun set-env-from-shell () | |
"シェル の PATH と alias を、emacs に引き継ぐ" | |
(let* ((trim (lambda (string &optional needle) | |
(let* ((n (if needle needle "[ \t\n\r]+")) | |
(s (if (string-match (concat "\\`" n) string) | |
(replace-match "" t t string) | |
string))) | |
(if (string-match (concat n "+\\'") s) | |
(replace-match "" t t s) | |
s)))) |
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
(defun trim (string &optional needle) | |
"Remove needle at the beginning and endding of string." | |
(let ((n (if needle needle "[ \t\n\r]+")) | |
(s (if (string-match (concat "\\`" n) string) ; "\`" バッファや文字列の先頭 | |
(replace-match "" t t string) | |
string))) | |
(if (string-match (concat n "+\\'") s) ; "\'" バッファや文字列の末尾 | |
(replace-match "" t t s) | |
s))) |
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
<?php | |
header('Content-Type: application/json'); | |
$secret = 'パスワード'; | |
$repo = 'リポジトリの名前'; | |
function generate_response($code) { | |
$response = array( | |
'200' => array( | |
'status' => 'success', | |
'errors' => null |
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
#!/bin/sh | |
while getopts dyh OPT | |
do | |
case $OPT in | |
"d" ) | |
flag_d=1 | |
;; | |
"y" ) | |
flag_y="-y" |
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
(add-hook 'kill-emacs-hook 'frame-size-save); Emacs終了時 | |
(add-hook 'window-setup-hook 'frame-size-resume); Emacs起動時 | |
(defun frame-size-save () | |
(set-buffer | |
(find-file-noselect (expand-file-name "~/.emacs.d/.framesize"))) | |
(erase-buffer) | |
(insert (concat | |
"(set-frame-width (selected-frame) " | |
(int-to-string (frame-width)) | |
") (set-frame-height (selected-frame) " |
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
(defmacro between (var start end &optional $=) | |
`(cond ((null ,var) nil) | |
((numberp ,var) | |
(let (($$ (if ,$= '<= '<))) | |
(and (funcall $$ ,start ,var) (funcall $$ ,var ,end)))) | |
((stringp ,var) | |
(if ,$= | |
(or (and (string< ,start ,var) (string< ,var ,end)) (string= ,start ,var) (string= ,var ,end)) | |
(and (string< ,start ,var) (string< ,var ,end)))) | |
(t (error "comparing neither numberp nor stringp")))) |
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
(mapcar* 'cons '(a b c) '(1 2 3 4)) | |
;=>((a . 1) (b . 2) (c . 3)) | |
(mapcar* 'cons '(a b c) '(1 2 3 4) '(5 6 7)) | |
;=>error | |
(mapcar* (lambda (a b c) | |
(+ a b c)) | |
'(1 2 3) |