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 rdp | |
| import "math" | |
| type point [2]float64 // [x, y] | |
| // RDPSimplify is an in-place implementation of Ramer–Douglas–Peucker. | |
| func RDPSimplify(points []point, epsilon float64) []point { | |
| return points[:rdpCompress(points, epsilon)] | |
| } |
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 main | |
| import ( | |
| "net/http" | |
| "github.com/zenazn/goji" | |
| ) | |
| func init() { | |
| goji.Get("/*", http.FileServer(http.Dir("./"))) |
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
| <?php | |
| // Now I remember why I don't use PHP anymore. | |
| function repeat($n) { | |
| return function() use ($n) { | |
| return [$n, repeat($n)]; | |
| }; | |
| } | |
| function countFrom($n) { |
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
| #!/usr/bin/env ruby | |
| log = `git log --oneline --shortstat` | |
| puts log | |
| i = 0 | |
| d = 0 | |
| log.each_line { |l| | |
| ii = /([0-9]+) insertion/.match(l) |
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
| using terms from application "Mail" | |
| on perform mail action with messages theMessages | |
| tell application "Mail" | |
| repeat with theMessage in theMessages | |
| set theText to content of theMessage | |
| set theSender to sender of theMessage | |
| set TempTID to AppleScript's text item delimiters | |
| set AppleScript's text item delimiters to space | |
| set theText to text items of theText |
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
| <?php | |
| function ranHex(){ | |
| $i = rand(0, 15); | |
| switch ($i) { | |
| case 0: $a = "0"; break; | |
| case 1: $a = "1"; break; | |
| case 2: $a = "2"; break; | |
| case 3: $a = "3"; break; |