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 examples.database; | |
import com.google.common.collect.Lists; | |
import examples.database.dao.PeopleDAO; | |
import examples.database.model.PeopleInfo; | |
import org.apache.commons.lang.time.StopWatch; | |
import org.apache.commons.logging.Log; | |
import org.apache.commons.logging.LogFactory; | |
import org.junit.Test; | |
import org.junit.runner.RunWith; |
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 ehcache.examples; | |
import java.io.*; | |
public class MySqlCLI { | |
private String mysqlBinaryPath = "/usr/local/bin/mysql"; | |
public String getMysqlBinaryPath() { | |
return mysqlBinaryPath; |
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 com.cliff.xmlns; | |
import org.dom4j.Document; | |
import org.dom4j.DocumentFactory; | |
import org.dom4j.Node; | |
import org.dom4j.XPath; | |
import org.dom4j.io.SAXReader; | |
import org.junit.Before; | |
import org.junit.Test; | |
import org.xml.sax.Attributes; |
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
require 'bindata' | |
class CustomProtocol < BinData::Record | |
endian :big | |
stringz :command_word | |
uint8 :op1 | |
uint8 :op2 | |
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
export MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=256M" | |
function maven-new-proj() { | |
if [ ! $# -eq 2 ]; then | |
echo "Usage: maven-new-proj example.org:some-archetype:1.0 mygroupid.myartifact" | |
fi | |
OIFS=$IFS | |
IFS=':' | |
read -rA ARCH_GAV <<< "$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
(require '[clojure.data.csv :as csv] | |
'[clojure.java.io :as io]) | |
(defn read-hitting-stats | |
"Reads hitting stats from a CSV file." | |
[csv-file] | |
(with-open [rdr (io/reader csv-file)] | |
(doall | |
(map parse-hitter (csv/read-csv rdr))))) |
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
;; binary tree using defrecord (as oppossed to maps) | |
(defrecord TreeNode [val l r]) | |
;; constructor method: creates a new tree | |
(defn make-tree [root] | |
(TreeNode. root nil nil)) | |
;; creates a new binary tree by appending v to existing tree | |
(defn tree-append [t v] | |
(cond |
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 joy.sql | |
"SQL DSL example from chapter 1." | |
(:require [clojure.string :as str])) | |
(defn expand-expr [expr] | |
(if (coll? expr) | |
(if (= (first expr) `unquote) ;;#: Handle unsafe literals | |
"?" | |
(let [[op & args] expr] | |
(str "(" (str/join (str " " op " ") (map expand-expr args)) ")"))) |
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
class StrategyRunner { | |
Map strategyMap = [:] | |
interface IStrategy { | |
boolean apply(arg) | |
}; | |
def addStrategy(String name, Closure cl) { |
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
================= | |
pom.xml | |
================= | |
<?xml version="1.0" encoding="UTF-8"?> | |
<!-- Copyright (C) 2011, EclipseSource and others All rights reserved. This | |
program and the accompanying materials are made available under the terms | |
of the Eclipse Public License v1.0 which accompanies this distribution, and | |
is available at http://www.eclipse.org/legal/epl-v10.html --> |