Instantly share code, notes, and snippets.

Tim Yates timyates

• Manchester, UK
Created July 17, 2009 14:10 — forked from loverdos/findcmd.scala
This file contains 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
 #!/usr/bin/env groovy // Trying it in Groovy as a shell script (just for fun) import java.util.regex.Pattern // All folders on the path which have contents: path = System.env[ 'PATH' ] .tokenize( File.pathSeparator ) .collect( { new File( it ) } )
Created June 8, 2012 11:03 — forked from rhyolight/rdp.js
Ramer-Douglas-Peucker line filtering algorithm in JavaScript
This file contains 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
 findPerpendicularDistance = ( point, line ) -> [pointX,pointY] = point[0..1] lineStart = x: line[0][0], y: line[0][1] lineEnd = x: line[1][0], y: line[1][1] slope = ( lineEnd.y - lineStart.y ) / ( lineEnd.x - lineStart.x ) intercept = lineStart.y - ( slope * lineStart.x ) Math.abs( slope * pointX - pointY + intercept ) / Math.sqrt( Math.pow( slope, 2) + 1) douglasPeucker = ( points, epsilon ) -> maxIndex = maxDistance = 0
Last active December 17, 2015 16:59 — forked from anonymous/Reshape.md

From the simple R example of reshape here, given a List of Maps like this:

```data = [ [ id: 1, time: 1, x1: 5, x2: 6 ],
[ id: 1, time: 2, x1: 3, x2: 5 ],
[ id: 2, time: 1, x1: 6, x2: 1 ],
[ id: 2, time: 2, x1: 2, x2: 4 ] ]```

And the methods `melt`:

Last active January 2, 2016 09:49 — forked from dmahapatro/AddPrimes.groovy
This file contains 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
 //Project Euler # 10 //http://projecteuler.net/problem=10 @GrabResolver( name='s', root='https://oss.sonatype.org/repositories/snapshots' ) @Grab(group='org.gperfutils', module='gbench', version='0.4.2-groovy-2.1') @Grab( 'com.bloidonia:groovy-stream:0.7.0-SNAPSHOT' ) import groovy.transform.* import groovy.stream.Stream import groovyx.gbench.Benchmark