Skip to content

Instantly share code, notes, and snippets.

@talios
talios / gist:8907132
Created February 9, 2014 22:39
Strange git case sensitivity issue on OS/X
$ git branch -vv --no-merged
feature/JDK8 8e89521 First steps to JDK8
feature/jdk8 da4efaa WIP JDK8 Streams/Lambda Migration
$ git checkout feature/JDK8
Switched to branch 'feature/JDK8'
$ git checkout feature/jdk8
Switched to branch 'feature/jdk8'
@talios
talios / git-mvnrelease
Created March 21, 2014 21:00
Git command to wrap handling Apache Maven Releases with GitFlow
#!/bin/sh
if ! git diff-index --quiet HEAD --; then
echo "Git is dirty, clean up your mess!"
exit 1
fi
VERSION=`xml sel -N x="http://maven.apache.org/POM/4.0.0" -t -v "/x:project/x:version" pom.xml`
BASEVERSION=${VERSION%-SNAPSHOT}
ARTIFACTID=`xml sel -N x="http://maven.apache.org/POM/4.0.0" -t -v "/x:project/x:artifactId" pom.xml`
@talios
talios / gist:9944948
Created April 2, 2014 22:52
Nashorn returns a different type for array lengths :(
$ /Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/bin/jrunscript
nashorn> [1,2,3].length
3
$ jrunscript
js> [1,2,3].length
3.0
@talios
talios / gist:bdb79750df7e5cba6d54
Last active August 29, 2015 14:02
Simple implementation of the clojure "thread macro" or F# pipe operator...
implicit class Piper[A](val a: A) extends AnyVal {
def |>[B](fn: (A => B)): B = fn(a)
}
def add5(a: Int) = a + 5
def times2(a: Int) = a * 2
def pipeit(a: Int) = {
(a |> add5
|> times2
@talios
talios / netchat.hs
Created July 7, 2014 10:36
Network Chat in Haskell.
import Control.Concurrent
import Control.Concurrent.Chan
import Data.UUID
import Data.UUID.V4
import Network.Socket
import System.IO
data Message = Message UUID String
deriving (Show, Eq)
<plugin>
<groupId>com.theoryinpractice.clojure</groupId>
<artifactId>clojure-maven-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<executions>
<execution>
<id>clojure-compile</id>
<goals>
<goal>compile</goal>
</goals>
(ns com.theoryinpractise.clojure.runnable
(:gen-class
:implements [java.lang.Runnable]))
(defn -run [this]
(println "Hello World... from clojure!"))
package com.theoryinpractise.clojure;
import org.osgi.framework.ServiceReference;
import org.osgi.service.component.ComponentContext;
import java.util.Properties;
/**
* @scr.component
*/
diff --git a/src/jvm/clojure/lang/RT.java b/src/jvm/clojure/lang/RT.java
index 502f00d..2e6e01b 100644
--- a/src/jvm/clojure/lang/RT.java
+++ b/src/jvm/clojure/lang/RT.java
@@ -348,8 +348,7 @@ static public long lastModified(URL url,String libfile) throws Exception{
}
else
{
- File f = new File(url.toURI());
- return f.lastModified();
<plugin>
<groupId>org.clojure</groupId>
<artifactId>clojure-maven-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<configuration>
<namespaces>
<namespace>clj-web-crawler</namespace>
<namespace>smx-api</namespace>
</namespaces>
<testScript>src/test/java/test.clj</testScript>