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 defdelegation | |
[protocol-name options & body] | |
(let [{:keys [prefix] :or {prefix "-"}} (if (map? options) options {}) | |
body (if (map? options) body (cons options body)) | |
protocol-body (mapv (fn [definition] | |
(let [fn-sym (first definition) | |
fn-body (rest definition)] | |
(apply list (symbol (str prefix (name fn-sym))) fn-body))) | |
body) | |
fn-defs (mapv (fn [definition] |
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
#!/usr/bin/env bash | |
function check_error() { | |
ret=$? | |
msg=$1 | |
code=$2 | |
if [[ $RET -ne 0 ]] | |
then | |
echo "error: $1" >&2 | |
exit $code |
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
#!/usr/bin/env bash | |
function check_error() { | |
ret=$? | |
msg=$1 | |
code=$2 | |
if [[ $RET -ne 0 ]] | |
then | |
echo "error: $1" >&2 | |
exit $code |
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
(fact "user-ageはユーザの年齢を返す" | |
(user-age ..name..) => ..age.. | |
(provided | |
(fetch-user-data ..name..) => {:age ..age.., :name ..name..})) |
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
/* | |
* Copyright 2011 Tsutomu YANO. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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
/* | |
* Copyright 2011 Tsutomu YANO. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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
package jp.javelindev.snippets; | |
public class Java8Sample { | |
public static void main(String[] args) { | |
Laco laco = new Laco(); | |
SampleClass sample = new SampleClass(); | |
sample.func(laco); //ClassCastException SomeClassはLacoにキャストできません | |
} |
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/bash | |
sudo kill `ps -ax | grep 'coreaudiod' | grep 'sbin' |awk '{print $1}'` |
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
(ns mdsample.core | |
(:require [clojure.core.reducers :as r] | |
[clojure.core.async :refer [chan >! <!! go close! alts!!]]) | |
(:import [java.security MessageDigest] | |
[javax.xml.bind DatatypeConverter] | |
[java.util Arrays] | |
[java.util Queue] | |
[java.util.concurrent ConcurrentLinkedQueue])) | |
(defn- hexdigest |
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
package example.mdsample.java; | |
import java.io.UnsupportedEncodingException; | |
import java.security.MessageDigest; | |
import java.security.NoSuchAlgorithmException; | |
import javax.xml.bind.DatatypeConverter; | |
import org.apache.commons.lang.StringUtils; | |
public class App { |
NewerOlder