Skip to content

Instantly share code, notes, and snippets.

@condotti
condotti / timeline.html (partial)
Last active January 9, 2020 07:14
Dual-Y Annotated Timeline of Google Chart Tools
<div id="target"></div>
<script src="https://www.gstatic.com/charts/loader.js"></script>
<script>
(function() {
'use strict';
function drawChart() {
var query = new google.visualization.Query('https://docs.google.com/spreadsheets/d/1BzKIB93LvvdmWmxdKAk99V7vWDKBOq6P3HqQeQnwLpI/edit?usp=sharing');
query.send(handleQueryResponse);
}
function handleQueryResponse(response){
@condotti
condotti / 0_reuse_code.js
Created December 1, 2016 09:27
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@condotti
condotti / my-elnode-server.el
Created April 18, 2014 07:11
Bracketsみたいなアレ
(require 'elnode)
(defun my-elnode-server (docroot port)
"Static server"
(interactive (list
(read-directory-name "Document root: " default-directory)
(read-number "Port: " 8001)))
(elnode-start (elnode-webserver-handler-maker docroot) :port port))
@condotti
condotti / init.el
Created November 9, 2012 05:19
sr-speedbarに行番号を表示しない
(defadvice linum-on (around linum-on-around)
(unless (string-match "SPEEDBAR" (buffer-name))
ad-do-it))
;;; clarity-theme.el --- Clarity and beauty, imported from color-theme 6.6.0
(deftheme clarity
"Clarity and beauty, imported from color-theme 6.6.0")
(custom-theme-set-faces 'clarity
'(default ((t (:stipple nil :background "black" :foreground "white" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 98 :width normal :foundry "outline" :family "Courier New"))))
'(bold ((t (:weight bold))))
'(italic ((t (:slant italic))))
'(bold-italic ((t (:slant italic :weight bold))))
@condotti
condotti / my-dump-theme.el
Created March 14, 2012 11:40
color-themeをemacs24のthemeに変換するモノ
(load-library "cl-extra")
(defun my-get-face-attributes (face)
(reverse
(mapcan '(lambda (a)
(let ((v (face-attribute face a)))
(if (not (or (eq a :inherit) (eq v 'unspecified)))
(list v a))))
(mapcar 'car face-attribute-name-alist))))
@condotti
condotti / clarity-theme.el
Created March 8, 2012 11:27
color-themeにあったclarity and beautyというテーマが24になさげだったので、やっつけでポート(というかほぼコピペ)。clarityが好きな人って多そうな気がするんだけど、そうでもない?
;;; clarity-theme.el --- White on black color theme by Richard Wellum, created 2003-01-16.
;; Copyright (C) 2012 condotti
;; Author: Akio Kondo <akondo21@gmail.com>
;; Keywords:
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
(defn combination [k xs]
(if (pos? k)
(if (<= (count xs) k) (list xs)
(concat
(map #(conj % (first xs)) (combination (dec k) (rest xs)))
(combination k (rest xs))))))
(defn all-partitions [xs]
(map #(list % (seq (reduce disj (set xs) %)))
(combination (/ (count xs) 2) xs)))
@condotti
condotti / bf2.clj
Created October 9, 2011 08:32
brainfuck interpreter in Clojure, transient vector version
(defn brainfuck2 [s]
(let [c (transient (vec (repeat 30000 (byte 0))))]
(letfn [(fmb [[t p] f ip] ; find matching bracket
((fn [ip n]
(condp = (nth s ip)
t (if (= n 0) ip (recur (f ip) (dec n)))
p (recur (f ip) (inc n))
(recur (f ip) n)))
ip 0))]
((fn [dp ip]
@condotti
condotti / bf.clj
Created October 9, 2011 08:27
brainfuck interpreter in Clojure
(defn brainfuck [s]
(letfn [(fmb [[t p] f ip] ; find matching bracket
((fn [ip n]
(condp = (nth s ip)
t (if (= n 0) ip (recur (f ip) (dec n)))
p (recur (f ip) (inc n))
(recur (f ip) n)))
ip 0))]
((fn [c dp ip]
(if (< ip (count s))