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
| def text_to_number(text, n=1000) | |
| '0.' + text[0..n].unpack('C*').map{ |i| "%02d" % i}.join('') | |
| 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
| `mkfifo fifotest` | |
| Process.fork do | |
| puts "We're going to write a message to a process who will pick it up later" | |
| nonblocking = open('fifotest', 'w+') | |
| nonblocking.puts "A message for you, Rudy\r\n" | |
| nonblocking.flush | |
| nonblocking.close | |
| puts "Done writing" | |
| 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
| $program = <<'EOP'; | |
| $program = <<'EOC'; | |
| EXPANDME | |
| EOC | |
| $program = substr($program,0,-1); | |
| $outer = $program; | |
| $outer =~ s/EOC(..)$/EOP$1/m; | |
| $outer =~ s/EOC$/EOP/m; | |
| $outer =~ s/EXPANDME/$program/; | |
| print $outer; |
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
| /* | |
| Find the 3D coordinates at depth z that project onto planar coordinates (x,y). | |
| Screen position is at z-1 in the screen coordinate system, so z should be less than -1 | |
| (basically inverse for screenX/screenY) | |
| */ | |
| PVector screenToDepth(float x, float y, float z) { | |
| // first get the transforms in place | |
| PMatrix3D M = (PMatrix3D) g.getMatrix(); | |
| PMatrix3D P = (PMatrix3D) ((PGraphics3D) g).getProjection(); | |
| P.apply(M); |
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
| /* Convert selection to HTML entitites - danish chars only */ | |
| CmdUtils.CreateCommand({ | |
| name: "entitize", | |
| icon: "http://www.classy.dk/favicon.ico", | |
| homepage: "http://www.classy.dk/", | |
| author: { name: "Claus Dahl", email: "dee@classy.dk"}, | |
| license: "GPL", | |
| description: "Translates danish characters to html entities", | |
| help: "select text and apply to replace with entitized text", |
NewerOlder