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
;; Macros in this file provides a "autoload" facility like Emacs Lisp has. | |
;; These are supposed to be used in a Lisp init file. | |
;; | |
;; Without those, you have to load all libraries you not sure whether they will be used or not. | |
;; | |
;; (ql:quickload :repl-utilities) | |
;; (use-package :repl-utilities) | |
;; | |
;; "Autoload" facility delays loading libraries until they are needed. | |
;; See the following 3 macros and their documentations. |
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
;; This is a answer for a question of CodeIQ. | |
;; https://codeiq.jp/ace/cielavenir/q431 | |
(in-package :cl-user) | |
(defmacro print-capitalized (symbol &rest symbols) | |
`(progn | |
(princ ,(string-capitalize symbol)) | |
,@(loop for s in symbols | |
collect `(princ ,(name-char 'space)) |
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
(ql:quickload '(chipz archive)) | |
(defun extract-tarball (pathname) | |
"Extract a tarball (.tar.gz) file to a directory (*default-pathname-defaults*)." | |
(with-open-file (tarball-stream pathname | |
:direction :input | |
:element-type '(unsigned-byte 8)) | |
(archive::extract-files-from-archive | |
(archive:open-archive 'archive:tar-archive | |
(chipz:make-decompressing-stream 'chipz:gzip tarball-stream) |
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
;; https://twitter.com/potix2/status/371962749246394368 | |
;; Usage | |
;; $ ls -l | shly sumsize | |
(ql:quickload :cl-ppcre) | |
(defun sumsize () | |
(loop with sum = 0 | |
for line = (read-line *standard-input* nil) | |
while line |
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 git-blame-current-line () | |
(interactive) | |
(let ((blame-result | |
(shell-command-to-string | |
(format "git blame -p -L %d,+1 %s" (line-number-at-pos) (buffer-file-name)))) | |
(result (make-hash-table :test 'equal))) | |
(loop with (commit . lines) = (split-string blame-result "\n") | |
for line in lines | |
for (key . values) = (split-string (or line "") " ") | |
do (setf (gethash key result) (mapconcat 'identity values " ")) |
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
$(function() { | |
$('.section h3').each(function() { | |
var entry = $(this); | |
var permalink = entry.find('a').first().attr('href'); | |
$.get(permalink + '?mode=json').success(function(data) { | |
var button = $('<button>').text('コピー'); | |
button.on('click', function() { | |
window.prompt("Copy to clipboard: Ctrl+C, Enter", data['body']); |
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
/* <system section="theme" selected="11696248318752473050"> */ | |
@import url("http://hatenablog.com/theme/11696248318752473050.css"); | |
/* </system> */ | |
/* <system section="background" selected="a5b095"> */ | |
body{background:#a5b095;} | |
/* </system> */ | |
/* ↓の部分を追加 */ | |
.entry-content p { |
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
@charset "UTF-8"; | |
body { | |
font-family: "Trebuchet MS", Arial, Helvetica, san-serif; | |
background: none; | |
} | |
#logo { | |
width: 120px; | |
height: 27px; |
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
import os | |
import re | |
import shutil | |
import time | |
import sys | |
from watchdog.observers import Observer | |
from watchdog.tricks import Trick | |
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
(defvar paren-face 'paren-face) | |
(make-face 'paren-face) | |
(set-face-foreground 'paren-face "#666666") | |
(dolist (mode '(lisp-mode | |
emacs-lisp-mode | |
scheme-mode)) | |
(font-lock-add-keywords mode | |
'(("(\\|)" . paren-face)))) |