This file contains hidden or 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
| def pascalsTraiangle(col: Int, row: Int): Int = { | |
| if(col == 0 ){ | |
| 1 | |
| }else if (col == row){ | |
| 1 | |
| }else | |
| pascalsTraiangle((col - 1),(row - 1)) + pascalsTraiangle(col, (row - 1)) | |
| } |
This file contains hidden or 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
| (defroute task-show ("/tasks/:id" :method :GET) (&key id) | |
| "指定されたIDのJSONを返却します。存在しない場合はHTTPステータスコード404を返却します。" | |
| (let ((task (find-task-from-db (parse-integer id)))) | |
| (if (eq task nil) | |
| (progn | |
| (setf (status *response*) 404) | |
| "") | |
| (render-json task)))) | |
| (defun find-task-from-db (id) |
This file contains hidden or 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
| (defroute "/*" () | |
| (setf (headers *response* :content-type) "application/json") | |
| (next-route)) | |
| (defroute task-index ("/tasks" :method :GET) () | |
| "JSONのArrayを返却します。空の場合は[]を返却します" | |
| (let* | |
| ((tasks (find-all-tasks-from-db)) | |
| (delim-start "[") | |
| (delim-end "]") |
This file contains hidden or 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
| ### | |
| ### http://d.hatena.ne.jp/oovu70/20120405/p1 | |
| ### | |
| # (d) is default on | |
| # ------------------------------ | |
| # General Settings | |
| # ------------------------------ | |
| export EDITOR=vim # エディタをvimに設定 | |
| export LANG=ja_JP.UTF-8 # 文字コードをUTF-8に設定 |
This file contains hidden or 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
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| ;; ruby | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| (autoload 'ruby-mode "ruby-mode" | |
| "Mode for editing ruby source files" t) | |
| (add-to-list 'auto-mode-alist '("\\.rb$" . ruby-mode)) | |
| (add-to-list 'auto-mode-alist '("Capfile$" . ruby-mode)) | |
| (add-to-list 'auto-mode-alist '("Gemfile$" . ruby-mode)) | |
| (require 'rdebug) |
This file contains hidden or 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
| (in-package :cl-user) | |
| (defpackage myapp.model | |
| (:use :cl | |
| :caveman | |
| :myapp.app)) | |
| (in-package :myapp.model) | |
| (ql:quickload :yason) | |
| (ql:quickload :closer-mop) |
This file contains hidden or 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
| (ql:quickload :dbi) | |
| (ql:quickload :yason) | |
| (ql:quickload :closer-mop) | |
| ;; cityクラスの定義 | |
| (defclass city () | |
| ((id | |
| :initarg :id | |
| :initform 0 | |
| :accessor id) |
This file contains hidden or 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
| (ql:quickload :dbi) | |
| ;; cityクラスの定義 | |
| (defclass city () | |
| ((id | |
| :initarg :id | |
| :initform 0 | |
| :accessor id) | |
| (name | |
| :initarg :name |
This file contains hidden or 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
| `(:static-path #p"static/" | |
| :log-path #p"log/" | |
| :template-path #p"templates/" | |
| :application-root ,(asdf:component-pathname | |
| (asdf:find-system :myapp)) | |
| :server :hunchentoot | |
| :port 5000 | |
| :database-driver :mysql | |
| :database-args (:database-name "world" :username "myapp" :password "<パスワード>")) | |
| ) |
This file contains hidden or 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
| #| | |
| This file is a part of myapp project. | |
| |# | |
| (in-package :cl-user) | |
| (defpackage myapp | |
| (:use :cl | |
| :clack | |
| :clack.builder | |
| :clack.middleware.static |