classDiagram
Animal <|-- Duck
Animal <|-- Fish
Animal <|-- Zebra
Animal : +int age
Animal : +String gender
Animal: +isMammal()
Animal: +mate()
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 java.awt.Color | |
import java.awt.Font | |
import java.awt.image.BufferedImage | |
import java.io.File | |
import javax.imageio.ImageIO | |
fun main(args: Array<String>) { | |
val img = BufferedImage(28 * 7, 40, BufferedImage.TYPE_3BYTE_BGR) | |
val g = img.graphics | |
g.color = Color.WHITE |
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 parse-program (s) | |
"expect: | |
(:program | |
((:class | |
..... | |
....)))" | |
(loop for program in (cadr s) | |
do (cond ((and (listp program) | |
(eq (car program) :class)) | |
(parse-class program)) |
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
;; connection pool | |
(defvar *connection-pool* nil) | |
;; アプリケーションサーバが立ち上がるときに実行 | |
(defun init-database (driver-name &rest params &key database-name &allow-other-keys) | |
"initialize database" | |
(setf *connection-pool* (apply #'dbi-cp:make-dbi-connection-pool driver-name params))) | |
;; アプリケーションサーバ終了時に実行 | |
(defun shutdown-database () |
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
@select ( | |
" select | |
product_id, | |
product_name, | |
product_price, | |
product_image, | |
product_url | |
from | |
product | |
where |
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 parameterized-sql-parse (sql) | |
(let* ((params nil) | |
(sql (with-output-to-string (s) | |
(loop with colon = NIL | |
with quoted = NIL | |
with prev = #\Space | |
with param = '() | |
for c across sql | |
if (and (not colon) (not quoted)) | |
if (char= c #\:) |
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
<html> | |
<head> | |
</head> | |
<link rel="stylesheet" href="https://storage.googleapis.com/code.getmdl.io/1.0.2/material.indigo-pink.min.css"> | |
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"> | |
<body> | |
<nav class="mdl-navigation"> | |
<a class="mdl-navigation__link" href="">Home</a> | |
<a class="mdl-navigation__link smooth" href="#product">Product</a> | |
</nav> |
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 generate-numseq (size) | |
"指定したサイズの数列を作る" | |
(let ((gen-list '())) | |
(labels ((gen (current num-list) | |
(if (< current size) | |
(loop for x from 1 to size | |
if (not (member x num-list)) | |
do (gen (1+ current) (cons x num-list))) | |
(push num-list gen-list)))) | |
(loop for x from 1 to size |
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
{- | |
1~100までの二乗の和と、1~100までの和の二乗との差分を求める。 | |
1~100までの二乗の和 | |
foldl (+) 0 $ map (^ 2) [1..100] | |
1~100までの和の二乗 | |
(^ 2) $ foldl (+) 0 [1..100] | |
-} |
NewerOlder