Skip to content

Instantly share code, notes, and snippets.

Avatar
😇
nemui

Eitaro Fukamachi fukamachi

😇
nemui
View GitHub Profile
@fukamachi
fukamachi / gist:2514290
Created Apr 27, 2012
Clack uploading sample
View gist:2514290
(import 'clack.request:make-request 'clack.request:body-parameter)
(clack:clackup
#'(lambda (env)
(format t "~S~%"
(body-parameter (make-request env)))
'(200
(:content-type "text/html")
("<form method='POST' enctype='multipart/form-data'><input type='file' name='pdf'><input type='submit'></form>"))))
@fukamachi
fukamachi / inverse-fizzbuzz.lisp
Created May 17, 2012
Inverse FizzBuzz in Common Lisp
View inverse-fizzbuzz.lisp
;; http://www.jasq.org/2/post/2012/05/inverse-fizzbuzz.html
;; http://d.hatena.ne.jp/matarillo/20120515/p1
#.(progn
(ql:quickload :optima)
(ql:quickload :alexandria)
(ql:quickload :cl-test-more)
(values))
(setq *print-circle* t)
@fukamachi
fukamachi / gist:3964573
Created Oct 27, 2012
Tutorial of cl-string-complete
View gist:3964573

This is a tutorial of cl-string-complete.

CL-USER> (ql:quickload :cl-string-complete)
To load "cl-string-complete":
  Install 1 Quicklisp release:
    cl-string-complete
; Fetching #<URL "http://beta.quicklisp.org/archive/cl-string-complete/2012-01-07/cl-string-complete-20120107-hg.tgz">
; 5.14KB
==================================================
@fukamachi
fukamachi / gist:4109258
Last active May 27, 2016
Pretty lambda/nil for Emacs
View gist:4109258
;; This function is quoted from this page. Thanks to Tomohiro Matsuyama.
;; http://dev.ariel-networks.com/Members/matsuyama/pretty-lambda-in-emacs/
(defun set-pretty-patterns (patterns)
(loop for (glyph . pairs) in patterns do
(loop for (regexp . major-modes) in pairs do
(loop for major-mode in major-modes do
(let ((major-mode (intern (concat (symbol-name major-mode) "-mode")))
(n (if (string-match "\\\\([^?]" regexp) 1 0)))
(font-lock-add-keywords major-mode
`((,regexp (0 (prog1 ()
@fukamachi
fukamachi / gist:4109289
Created Nov 19, 2012
Make the color of parenthesis gray.
View gist:4109289
(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))))
@fukamachi
fukamachi / less-watch.py
Last active Dec 12, 2015
LESS watch & compile.
View less-watch.py
import os
import re
import shutil
import time
import sys
from watchdog.observers import Observer
from watchdog.tricks import Trick
@fukamachi
fukamachi / gist:4744978
Created Feb 9, 2013
Toodledo Redesigned
View gist:4744978
@charset "UTF-8";
body {
font-family: "Trebuchet MS", Arial, Helvetica, san-serif;
background: none;
}
#logo {
width: 120px;
height: 27px;
@fukamachi
fukamachi / gist:5545090
Last active Dec 17, 2015
「↓の部分を追加」以下の部分を追加してください
View gist:5545090
/* <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 {
@fukamachi
fukamachi / g.hatena.ne.jp.js
Last active Dec 20, 2015
はてなグループで本文のはてな記法をコピーするdotjs
View g.hatena.ne.jp.js
$(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']);
View git-blame-current-line.el
(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 " "))
You can’t perform that action at this time.