Monday, January 7, 2008

Snippet: Compiler

Here's a little snippet (from a friend; thanks again, man!) that will allow you, out of the box, to compile and execute C# code from your SOS input. The results of that code are returned as your response. I'm sure all of the C# coders out there can appreciate this one. One (pretty big) added bonus is the fact that this snippet compiler is not bound to C#. It's not even bound to .NET! Within the configuration file, there are settings that will allow you to specify your own compiler, switches, and base code.

Click here to download the snippet: Compiler

Sample Input:
String text = "Hello World!";
foreach(Char c in text)
{
   String format = "[{0}:{1}] ";
   String character = c.ToString();
   String ascii = ((Int32)c).ToString();
   Console.Write(format, character, ascii.PadLeft(3, '0'));
}

Sample Output:
[H:072] [e:101] [l:108] [l:108] [o:111] [ :032] [W:087] [o:111] [r:114] [l:108] [d:100] [!:033]

SOS.Tray v0.11

Based on some excellent feedback, I've fixed a few issues I had not even noticed along with some enhancements that I had slated for later, but now realize were more crucial than I had originally anticipated.

Here is the change log for v0.11...

* Input/Output text fields in the GUI are now resizable.
* Input/Output text fields now have a font selection dialog.
* Input/Output text fields now have persisting properties (fonts and colors).
* The GUI's [x] (Close) button now hides the GUI, instead of closing it.
* The GUI's [_] (Minimize) button now minimizes the GUI, instead of hiding it.
* File system monitor now updates snippet menus and GUI tree automatically.
* Recent input tracking implemented. Currently tracks your last ten input items.

Click here to download Snippets on Steroids (S·O·S) v0.11

Thursday, December 27, 2007

Snippet: ROT-13

ROT-13 is a very simple variation of the Caesar Cipher in which each character is rotated thirteen positions along the Roman alphabet. The purpose of this simplistic cipher is typically to "obstruct" material from view; not necessarily to conceal it. The significance of the thirteen (over Caesar's three) is to allow the cipher to be used as a "toggle" instead of with separate encoding and decoding routines. Since the Roman alphabet has twenty-six letters, rotating a letter thirteen positions will give you its exact inverse; rotating again will give you the original.

Click here to download the snippet: ROT-13

Sample Input:
I'm ROT-13, baby!

Sample Output:
V'z EBG-13, onol!

Snippet: Die Roll

This snippet replaces instances of #d# in a text block with random numbers generated similarly to table-top gaming dice rolls. The random numbers are generated the same way that a die would be rolled in this situation (e.g. "3d6" equates to "roll random 1 to 6 three times; add all three rolls").

Click here to download the snippet: Die Roll

Sample Input:
I have a +1d3 Ring of Codefu, but I may be inclined to part with it for say... 3d20 gold? Hmmm...

Sample Output:
I have a +3 Ring of Codefu, but I may be inclined to part with it for say... 13 gold? Hmmm...

Snippet: HTML Encode

This snippet will ensure that text will store inside "markup" languages (i.e. HTML and XML). Nothing elegant... but highly useful. ;)

Click here to download the snippet: HTML Encode

Sample Input:
<Sample>Some common text & such. Lance really likes using the · symbol in S·O·S, doesn't he?</Sample>

Sample Output:
&lt;Sample&gt;Some common text &amp; such. Lance really likes using the &#183; symbol in S&#183;O&#183;S, doesn't he?&lt;/Sample&gt;

Snippet: Line Number

This snippet will prefix text line with their respective line numbers.
Handy little diagnostic snippet, it is. It supports configuration to change the line-numbers' surrounding characters.

Click here to download the snippet: Line Number

Sample Input:
* Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
* Donec posuere nulla eu eros.
* Mauris fringilla fermentum lorem.
* Morbi eget orci pulvinar nunc sodales malesuada.
* Integer at est at dui dapibus ultrices.

Sample Output:
(1) * Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
(2) * Donec posuere nulla eu eros.
(3) * Mauris fringilla fermentum lorem.
(4) * Morbi eget orci pulvinar nunc sodales malesuada.
(5) * Integer at est at dui dapibus ultrices.

SOS.Tray v0.8

So here is the download link to the installer for the SOS.Tray application. It will also install a "My SOS" folder into your "My Documents". This is crucial.

The SOS application looks at directories under the "My SOS" folder as categories for snippets (e.g. "My Documents\My SOS\Development"). Under these categories, it looks for ".sos" files (the console applications).

The installer does not contain any snippets by default, but I have a few that I will be posting soon. They are simply ".zip" files that you will need to extract into a category prior to use.

After installing any new snippets (until I write a bit more code), you will need to restart the SOS.Tray application to see the menus and trees rebuild.

Here is the download link for the SOS application...

Click here to download Snippets on Steroids (S·O·S) v0.8