Permalink
Browse files

prime modifiche

  • Loading branch information...
1 parent f72a42e commit ad4c4ba64644c37fc13e60ae8f64c4b61fe7e25a @mikosh75 committed Oct 12, 2011
Showing with 44 additions and 154 deletions.
  1. 0 README → README.txt
  2. +2 −152 index.html
  3. +42 −2 server.js
View
File renamed without changes.
View
@@ -25,161 +25,11 @@
</div>
<div id="loading"><p>loading</p></div>
<div id="log">
- <table class="message"><tr><td class="date">18:58</td><td valign="top" class="nick">TTilus</td>
- <td class="msg-text">x6a616e: i think you can, there was some weird #send trick to do that</td>
- </tr></table>
- <table class="message"><tr><td class="date">18:58</td><td valign="top" class="nick">TTilus</td>
- <td class="msg-text">(or i could just be terribly wrong)</td>
- </tr></table>
- <table class="message"><tr><td class="date">19:02</td><td valign="top" class="nick">x6a616e</td>
- <td class="msg-text">TTilus: with #send you can invoke private methods</td>
- </tr></table>
- <table class="message"><tr><td class="date">19:03</td><td valign="top" class="nick">x6a616e</td>
- <td class="msg-text">dunno how to leverage it to access instance var :-/</td>
- </tr></table>
- <table class="message"><tr><td class="date">19:05</td><td valign="top" class="nick">x6a616e</td>
- <td class="msg-text">i3d: usually I use rspec::mocks</td>
- </tr></table>
- <table class="message"><tr><td class="date">19:05</td><td valign="top" class="nick">dlisboa</td>
- <td class="msg-text">x6a616e: #instance_variable_get ?</td>
- </tr></table>
- <table class="message"><tr><td class="date">19:06</td><td valign="top" class="nick">x6a616e</td>
- <td class="msg-text">dlisboa: phew I forgot that ..</td>
- </tr></table>
- <table class="message"><tr><td class="date">19:19</td><td valign="top" class="nick">UrbanVegan</td>
- <td class="msg-text">How can I use "%" in a string as just another character (meaning "percent")?</td>
- </tr></table>
- <table class="message"><tr><td class="date">19:20</td><td valign="top" class="nick">ddfreyne</td>
- <td class="msg-text">"%"</td>
- </tr></table>
- <table class="message"><tr><td class="date">19:20</td><td valign="top" class="nick">ddfreyne</td>
- <td class="msg-text">:)</td>
- </tr></table>
- <table class="message"><tr><td class="date">19:20</td><td valign="top" class="nick">ddfreyne</td>
- <td class="msg-text">no need to escape it</td>
- </tr></table>
- <table class="message"><tr><td class="date">19:20</td><td valign="top" class="nick">dominikh</td>
- <td class="msg-text">%%</td>
- </tr></table>
- <table class="message"><tr><td class="date">19:21</td><td valign="top" class="nick">dominikh</td>
- <td class="msg-text">ddfreyne: if you use something like "%string" % 1</td>
- </tr></table>
- <table class="message"><tr><td class="date">19:21</td><td valign="top" class="nick">dominikh</td>
- <td class="msg-text">eh</td>
- </tr></table>
- <table class="message"><tr><td class="date">19:21</td><td valign="top" class="nick">dominikh</td>
- <td class="msg-text">you get the idea</td>
- </tr></table>
- <table class="message"><tr><td class="date">19:21</td><td valign="top" class="nick">ddfreyne</td>
- <td class="msg-text">"foo %s bar" % [ 'hello' ] # =&gt; "foo hello bar"</td>
- </tr></table>
- <table class="message"><tr><td class="date">19:21</td><td valign="top" class="nick">dominikh</td>
- <td class="msg-text">lets assume he has some other % stuff he wants to be replaced</td>
- </tr></table>
- <table class="message"><tr><td class="date">19:21</td><td valign="top" class="nick">ddfreyne</td>
- <td class="msg-text">"foo %% %s bar" % [ 'hello' ] # =&gt; "foo % hello bar"</td>
- </tr></table>
- <table class="message"><tr><td class="date">19:21</td><td valign="top" class="nick">dominikh</td>
- <td class="msg-text">and some he doesnt want to</td>
- </tr></table>
- <table class="message"><tr><td class="date">20:07</td><td valign="top" class="nick">bougyman</td>
- <td class="msg-text">docs should be in /usr/share, not /usr/lib/ruby/gems/1.8/doc, too</td>
- </tr></table>
- <table class="message"><tr><td class="date">20:07</td><td valign="top" class="nick">bougyman</td>
- <td class="msg-text">FHS is OS agnostic.</td>
- </tr></table>
- <table class="message"><tr><td class="date">20:08</td><td valign="top" class="nick">drbrain</td>
- <td class="msg-text">bougyman: FreeBSD doesn't follow the FHS</td>
- </tr></table>
- <table class="message"><tr><td class="date">20:08</td><td valign="top" class="nick">drbrain</td>
- <td class="msg-text">Apple doesn't follow the FHS, and windows doesn't follow the FHS</td>
- </tr></table>
- <table class="message"><tr><td class="date">20:08</td><td valign="top" class="nick">drbrain</td>
- <td class="msg-text">I really don't care about people who say "you don't X, Y or Z!" and won't pony up patches</td>
- </tr></table>
- <table class="message"><tr><td class="date">20:11</td><td valign="top" class="nick">bougyman</td>
- <td class="msg-text">the fbsd list seems split over FHS compliance</td>
- </tr></table>
- <table class="message"><tr><td class="date">20:11</td><td valign="top" class="nick">bougyman</td>
- <td class="msg-text">some of em want it, some give it the finger.</td>
- </tr></table>
- <table class="message"><tr><td class="date">20:11</td><td valign="top" class="nick">drbrain</td>
- <td class="msg-text">that's because they already have the heir man page</td>
- </tr></table>
- <table class="message"><tr><td class="date">20:12</td><td valign="top" class="nick">bougyman</td>
- <td class="msg-text">looks like they gave in on mounts to FHS 2.2 (freebsd did)</td>
- </tr></table>
- <table class="message"><tr><td class="date">20:12</td><td valign="top" class="nick">bougyman</td>
- <td class="msg-text">winFS was said to be FHS compliant.</td>
- </tr></table>
- <table class="message"><tr><td class="date">20:12</td><td valign="top" class="nick">bougyman</td>
- <td class="msg-text">maybe we'll see that in the next MS product.</td>
- </tr></table>
- <table class="message"><tr><td class="date">20:13</td><td valign="top" class="nick">bougyman</td>
- <td class="msg-text">it was supposed to be in Vista, but got scrapped.</td>
- </tr></table>
- <table class="message"><tr><td class="date">20:13</td><td valign="top" class="nick">ddfreyne</td>
- <td class="msg-text">stuff in /bin should have config stuff in /etc, stuff in /usr/bin should have their configs in
- /usr/etc, ... IMO
- </td>
- </tr></table>
- <table class="message"><tr><td class="date">20:13</td><td valign="top" class="nick">ddfreyne</td>
- <td class="msg-text">stuff in ~/bin should have their configs in ~/etc</td>
- </tr></table>
- <table class="message"><tr><td class="date">20:13</td><td valign="top" class="nick">ddfreyne</td>
- <td class="msg-text">that would make a lot more sense than it does now</td>
- </tr></table>
- <table class="message"><tr><td class="date">20:13</td><td valign="top" class="nick">ddfreyne</td>
- <td class="msg-text">... what kind of names are "etc" and "var" anyway?</td>
- </tr></table>
- <table class="message"><tr><td class="date">20:13</td><td valign="top" class="nick">ddfreyne</td>
- <td class="msg-text">"config" and "data" would have made more sense</td>
- </tr></table>
- <table class="message"><tr><td class="date">20:14</td><td valign="top" class="nick">bougyman</td>
- <td class="msg-text">they make sense to me.</td>
- </tr></table>
- <table class="message"><tr><td class="date">20:14</td><td valign="top" class="nick">ddfreyne</td>
- <td class="msg-text">even 'etc'? etcetera? "all the rest of the stuff goes here"?</td>
- </tr></table>
- <table class="message"><tr><td class="date">20:14</td><td valign="top" class="nick">bougyman</td>
- <td class="msg-text">etc. and variable are how I read them.</td>
- </tr></table>
- <table class="message"><tr><td class="date">20:14</td><td valign="top" class="nick">catalystmediastu</td>
- <td class="msg-text">Does anyone know of a gem or Rails plugin that converts rtf documents to HTML? I've </td>
- </tr></table>
- <table class="message"><tr><td class="date">20:15</td><td valign="top" class="nick">wmoxam</td>
- <td class="msg-text">catalystmediastu: I doubt it, you'll probably have to find a tool that does it, and call the tool</td>
- </tr></table>
- <table class="message"><tr><td class="date">20:15</td><td valign="top" class="nick">ddfreyne</td>
- <td class="msg-text">bougyman: you can't really say that 'etc' is a better name than 'config'</td>
- </tr></table>
- <table class="message"><tr><td class="date">20:16</td><td valign="top" class="nick">catalystmediastu</td>
- <td class="msg-text">wmoxam: I'll start looking for a generic tool for linux then. Thanks!</td>
- </tr></table>
- <table class="message"><tr><td class="date">20:16</td><td valign="top" class="nick">wmoxam</td>
- <td class="msg-text">catalystmediastu: http://sourceforge.net/projects/rtf2html/ &lt;-- might work</td>
- </tr></table>
- <table class="message"><tr><td class="date">20:17</td><td valign="top" class="nick">catalystmediastu</td>
- <td class="msg-text">wmoxam: Ahh that looks like it might. Thank you!</td>
- </tr></table>
- <table class="message"><tr><td class="date">20:17</td><td valign="top" class="nick">wmoxam</td>
- <td class="msg-text">np</td>
- </tr></table>
- <table class="message"><tr><td class="date">20:17</td><td valign="top" class="nick">bougyman</td>
- <td class="msg-text">catalystmediastu: unrtf works well for that.</td>
- </tr></table>
- <table class="message"><tr><td class="date">20:17</td><td valign="top" class="nick">bougyman</td>
- <td class="msg-text">http://www.gnu.org/software/unrtf/unrtf.html</td>
- </tr></table>
- <table class="message"><tr><td class="date">20:20</td><td valign="top" class="nick">catalystmediastu</td>
- <td class="msg-text">bougyman: Thanks, that looks like a good tool too. I'll look into them both a little
- more.
- </td>
- </tr></table>
+
</div>
<div id="toolbar">
<ul id="status">
- <li><a id="usersLink" href="#">5 users</a></li>
+ <li><a id="usersLink" href="#"></a></li>
<li>uptime: <span id="uptime">?</span></li>
<li>memory: <span id="rss">?</span>mb RSS</li>
</ul>
View
@@ -1,6 +1,46 @@
HOST = null; // localhost
PORT = 8001;
+// utility functions
+
+util = {
+ urlRE: /https?:\/\/([-\w\.]+)+(:\d+)?(\/([^\s]*(\?\S+)?)?)?/g,
+
+ // html sanitizer
+ toStaticHTML: function(inputHtml) {
+ inputHtml = inputHtml.toString();
+ return inputHtml.replace(/&/g, "&amp;")
+ .replace(/</g, "&lt;")
+ .replace(/>/g, "&gt;");
+ },
+
+ //pads n with zeros on the left,
+ //digits is minimum length of output
+ //zeroPad(3, 5); returns "005"
+ //zeroPad(2, 500); returns "500"
+ zeroPad: function (digits, n) {
+ n = n.toString();
+ while (n.length < digits)
+ n = '0' + n;
+ return n;
+ },
+
+ //it is almost 8 o'clock PM here
+ //timeString(new Date); returns "19:49"
+ timeString: function (date) {
+ var minutes = date.getMinutes().toString();
+ var hours = date.getHours().toString();
+ return this.zeroPad(2, hours) + ":" + this.zeroPad(2, minutes);
+ },
+
+ //does the argument only contain whitespace?
+ isBlank: function(text) {
+ var blank = /^\s*$/;
+ return (text.match(blank) !== null);
+ }
+};
+
+
// when the daemon started
var starttime = (new Date()).getTime();
@@ -32,7 +72,7 @@ var channel = new function () {
switch (type) {
case "msg":
- sys.puts("<" + nick + "> " + text);
+ sys.puts(util.timeString(new Date()) + " <" + nick + "> " + text);
break;
case "join":
sys.puts(nick + " join");
@@ -152,7 +192,7 @@ fu.get("/join", function (req, res) {
return;
}
- //sys.puts("connection: " + nick + "@" + res.connection.remoteAddress);
+ sys.puts("connection: " + nick + "@" + res.connection.remoteAddress + " with id: " + session.id);
channel.appendMessage(session.nick, "join");
res.simpleJSON(200, { id: session.id

0 comments on commit ad4c4ba

Please sign in to comment.