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
| (ns roll.core | |
| (:require [instaparse.core :as instaparse] | |
| [clojure.string :as str])) | |
| (def roll-parser | |
| (instaparse/parser " | |
| roll = quantity? <'d'> die-type (operator operand)? | |
| <quantity> = number | |
| <die-type> = number | |
| <operand> = number |
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
| boolean saveImage(String fileName, String contentType, InputStream inputStream) { | |
| Connection connection = null; | |
| PreparedStatement statement = null; | |
| ResultSet keySet = null; | |
| try { | |
| connection = dataSource.getConnection(); | |
| statement = connection.prepareStatement("INSERT INTO images (filename, content_type, content) values (?, ?, ?)", | |
| new String[] {"id"}); | |
| statement.setString(1, fileName); |
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
| package images; | |
| import java.io.FileInputStream; | |
| import java.io.IOException; | |
| import javax.servlet.ServletException; | |
| import javax.servlet.ServletOutputStream; | |
| import javax.servlet.annotation.WebServlet; | |
| import javax.servlet.http.HttpServlet; | |
| import javax.servlet.http.HttpServletRequest; | |
| import javax.servlet.http.HttpServletResponse; |
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
| (defun flatten (l) | |
| (cond | |
| ((null l) nil) | |
| ((listp l) (append (flatten (car l)) | |
| (flatten (cdr l)))) | |
| (t (list l)))) | |
| (flatten '()) | |
| (flatten 1) | |
| (flatten '(1 . 2)) |
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
| // capturing the hide event instead of the hidden event lets us intercept the close and update our state | |
| // | |
| componentDidMount = () => { | |
| $(this.node).on("hide.bs.modal", | |
| (e) => { | |
| if (this.props.open) { | |
| // if we say the modal should be open but it want's to close | |
| e.preventDefault(); // stop it from closing | |
| this.props.closeMe(); // update our state to request our close, if we want that behavior | |
| } |
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
| user> (defn try-it [ & [x & xs :as all-of-them]] | |
| all-of-them) | |
| #'user/try-it | |
| user> (try-it 1 2 3 4 5) | |
| (1 2 3 4 5) | |
| user> (defn try-it [ & [x & xs :as all-of-them]] | |
| x) | |
| #'user/try-it | |
| user> (try-it 1 2 3 4 5) |
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
| (defproject trypy "0.1.0-SNAPSHOT" | |
| :dependencies [[org.clojure/clojure "1.7.0"] | |
| [org.python/jython-standalone "2.5.2"]] | |
| :aliases {"jython" | |
| ["trampoline" "run" "-m" "org.python.util.jython"]}) | |
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
| package hello; | |
| import java.util.ArrayList; | |
| import java.util.Comparator; | |
| import java.util.List; | |
| public class CommentFun | |
| { |
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
| {:user | |
| {:plugins [[cider/cider-nrepl "0.9.0-SNAPSHOT" :exclusions [org.clojure/clojure]] | |
| [lein-pprint "1.1.1"]] | |
| :deploy-repositories [["austinclojure-snapshots" | |
| "http://repo.nostacktrace.com/nexus/content/repositories/snapshots/"] | |
| ["austinclojure-releases" | |
| {:url "http://repo.nostacktrace.com/nexus/content/repositories/releases/" | |
| :sign-releases false}]]} |
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
| wget http://www.motorlogy.com/apache//db/derby/db-derby-10.11.1.1/db-derby-10.11.1.1-bin.zip | |
| unzip db-derby-10.11.1.1-bin.zip | |
| cd db-derby-10.11.1.1-bin/ | |
| nohup bin/startNetworkServer & |