Skip to content

Instantly share code, notes, and snippets.

@hozumi
hozumi / foo.cljs
Created December 26, 2011 12:17
[ClojureScript] Wrapping all def into a load event handler
(defn init []
(def main (goog.dom/getElement "main"))
(def mydiv (goog.dom/createDom "div"))
(goog.dom/appendChild main mydiv)
(defn change-color-mydiv []
(... mydiv)))
@hozumi
hozumi / file0.css
Created January 4, 2012 15:14
text-shadowやbox-shadowにalphaなグラデーションかけるとかなりかっこ良くなる ref: http://qiita.com/items/1569
text-shadow: 0 1px 0 rgba(255,255,255,0.4),0 0 5px rgba(0,0,0,0.1);
@hozumi
hozumi / multi.clj
Created January 18, 2012 07:06
Multimethods bug
(defmulti foo (fn [x] x))
;=> #<[object Object]>
(defmethod foo ::a [x] "a!")
;=> #<[object Object]>
; Hierarchy setting
(derive ::a1 ::a)
;=> nil
; works well
; http://d.hatena.ne.jp/anton0825/20101229/1293213099
; 大体そのまま移植しただけ
; dfs なのにstackを用意していないように見えるのは
; 言語のstackをstackとして利用しているため。
(defn dfs [k [fs & res] sum]
(println sum fs res)
(if fs
(or (dfs k res (+ fs sum))
(dfs k res sum))
(= sum k)))
a:link { color:#111; text-decoration:none; }
a { color:#111; text-decoration:none; }
a:visited { color:#828282; text-decoration:none; }
@basic-background-color: #fdfdfd;
@basic-font-color: black;
@subtext-font-color: #828282;
@default-font-family: "メイリオ",Meiryo,"Meiryo UI","Segoe UI","ヒラギノ丸ゴ Pro W4",HiraMaruPro-W4,"Hiragino Maru Gothic Pro","ヒラギノ角ゴ Pro W3","Hiragino Kaku Gothic Pro",Osaka,"MS Pゴシック","MS PGothic",Merriweather,Verdana,Helvetica,Arial,Sans-Serif;
body {
@hozumi
hozumi / index121.html
Last active December 11, 2015 17:09
less #1152
<!DOCTYPE html>
<html>
<head>
<link href="style.less" rel="stylesheet/less" type="text/css">
<script src="less-1.2.1.js" type="text/javascript"></script>
</head>
<body>
<div id="wrapper" class="webkit-scrollbar-gray">
<div id="main">
hello
@hozumi
hozumi / util.clj
Last active December 12, 2015 10:28
(defn entity->map [convert-data entity]
(reduce (fn [m attr]
(if (keyword? attr)
(if-let [v (attr entity)]
(assoc m attr v)
m)
(let [[attr conv-fn] attr]
(if-let [v (attr entity)]
(assoc m attr (conv-fn v))
m))))
var xhr = new XMLHttpRequest();
// undefined
xhr.open('POST', 'http://localhost:4000/', true);
// undefined
xhr.onreadystatechange = function (a){console.log(a);}
// function (a){console.log(a);}
xhr.send('{"a":"b"}');
// undefined
// XMLHttpRequest cannot load http://localhost:4000/. Origin http://d.hatena.ne.jp is not allowed by Access-Control-Allow-Origin```
@hozumi
hozumi / monitrc
Last active December 15, 2015 06:48
monit setting
set daemon 60
set logfile syslog facility log_daemon
set idfile /var/.monit.id
set statefile /var/.monit.state
set mailserver smtp.gmail.com port 587
username "[email protected]" password "mypassword"
using tlsv1
with timeout 30 seconds
set alert [email protected]
set httpd port 2813 address localhost