Skip to content

Instantly share code, notes, and snippets.

View staypufd's full-sized avatar

Sam Griffith Jr staypufd

View GitHub Profile
@staypufd
staypufd / gist:ddc7d987ce2de28e0176
Created July 24, 2014 16:25
JSTL - Put at top of jsp pages
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
<Resource name="jdbc/quoteDB" auth="Container" type="javax.sql.DataSource"
maxActive="50" maxIdle="30" maxWait="10000"
username="SA" password=""
driverClassName="org.hsqldb.jdbc.JDBCDriver"
url="jdbc:hsqldb:hsql://localhost:9001/"/>
@staypufd
staypufd / gist:13e74b65c9a3fd46f32c
Last active August 29, 2015 14:05
quote jsp code
<sql:query var="results"
sql="select quotation, author from quote"
dataSource="jdbc/quoteDB">
</sql:query>
<c:forEach items="${results.rows }" var="row">
<p>${row.quotation } -- ${row.author }</p>
</c:forEach>
<table class="table table-striped">
<c:forEach items="${theQuotes }" var="aQuote">
<tr>
<td>
<blockquote class="blockquote">
<p>${aQuote.quote }</p>
<footer>
<c:out value="${aQuote.author }"/>
</footer>
</blockquote>
Windows - Run HSQLDB
NOTE: Assumes your hsqldb is installed at c:\ on your PC
java -cp c:\hsqldb-2.3.2\hsqldb\lib\hsqldb.jar org.hsqldb.server.Server
Mac - Run HSQLDB
NOTE: Assumes your hsqldb is installed at the top level of your home directory.
java -cp ~/hsqldb-2.3.2/hsqldb/lib/hsqldb.jar org.hsqldb.server.Server
create table quote (
id identity,
quotation varchar(1000) not null,
author varchar(100) not null,
);
insert into quote (quotation, author) values ('The hardest thing in the world to understand is the income tax.', 'Albert Einstein');
insert into quote (quotation, author) values ('The only thing that interferes with my learning is my education.', 'Albert Einstein');
insert into quote (quotation, author) values ('I am convinced that He (God) does not play dice.', 'Albert Einstein');
@staypufd
staypufd / Parent with two siblings
Last active September 23, 2015 13:37
This is the parent with the state that I want one child to be able to change and that triggers the render which looks at local state and then changes
(defn section-button-view [title-and-symbol-vector owner]
(om/component
(sab/html
[:div {:style {:color "black"
:border "1px solid grey"
:border-radius "4px"
:padding "5px"
:margin "5px"
:text-align "center"
@staypufd
staypufd / gist:3d246e33051e583de09a
Created October 22, 2015 01:56
Print out Datomic Query Results Nicely in REPL
;; Assumes a Datomic DB where an Entity is defined that has attribute
;; :park.amenity/label of type string. Subsitute your query in place
;; of this example.
(let [vec-str (->>
(d/q '[:find ?amenity-name
:where [?e :park.amenity/label ?amenity-name]]
(db))
(sort-by first))]
(doseq [x vec-str]
@staypufd
staypufd / gist:25ea1d2da98543b94a5ca2cedd259ddc
Created January 12, 2017 22:54
Playing with Om Next in Klipse
http://app.klipse.tech/?container&cljs_in.gist=viebel/69a7c0cdf289bad342fefe82fdeb7179