Permalink
Browse files

More work on the server

  • Loading branch information...
1 parent 1aebf12 commit fa3fc9d65475214ac3bc72548004d5eef63b0e25 @nhunzaker committed Mar 23, 2012
View
@@ -32,10 +32,13 @@ function compressor (directory, filetype, filename) {
return directory + "/" + f;
}
});
-
- var compressed = compress.all(directory, files, filename);
- return fs.writeFile(directory + "/" + newFile.trim(), compressed);
+ try {
+ var compressed = compress.all(directory, files, filename);
+ return fs.writeFile(directory + "/" + newFile.trim(), compressed);
+ } catch (x) {
+ return false;
+ }
});
@@ -72,21 +75,21 @@ module.exports = function compile (a) {
// Yes, watch the target
fs.watch(target, { persistent: true, interval: 1000 }, function () {
- nodebot.say("Files have changed. Compiling all %s in %s.", filetype.blue.bold, target.blue);
+ nodebot.say("Files have changed. Compiling all %s in %s.", filetype, target);
compressor(target, filetype);
});
compressor(target, filetype);
- nodebot.say("I am now compiling all %s in %s", filetype.blue.bold, target.blue);
+ nodebot.say("I am now compiling all %s in %s", filetype, target);
} else {
// No, use the current directory
fs.watch(process.cwd(), { persistent: true, interval: 1000 }, function () {
- nodebot.say("Files have changed. Compiling all %s into %s.", filetype.blue.bold, target.blue);
+ nodebot.say("Files have changed. Compiling all %s into %s.", filetype, target);
compressor(process.cwd(), filetype, target);
});
- nodebot.say("I am now compiling all %s into %s", filetype.blue.bold, target.blue);
+ nodebot.say("I am now compiling all %s into %s", filetype, target);
compressor(process.cwd(), filetype, target);
}
@@ -98,7 +101,7 @@ module.exports = function compile (a) {
// Make it so that when the user exits watching, it loads
// up another prompt
process.once('SIGINT', function () {
- nodebot.request("Okay, I am no longer compiling %s files.", filetype.bold.blue, target.blue);
+ nodebot.request("Okay, I am no longer compiling %s files.", filetype, target);
});
};
@@ -98,9 +98,7 @@ function compressAll (directory, files, filename) {
}).forEach(function(f) {
try {
stack.push([f, fs.readFileSync(f).toString()]);
- } catch (x) {
- console.log("Could not read file %s", f);
- }
+ } catch (x) {}
});
files = sortRequirements(stack, directory);
View
@@ -7,38 +7,27 @@
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
- <link rel="stylesheet" href="/stylesheets/base.css" />
- <style>
- input[type="text"] {
- display: block;
- margin: 0 auto;
- }
-
- p {
- margin: 1em 0;
- }
- </style>
+ <link rel="stylesheet" href="/stylesheets/style.css" />
<link rel="shortcut icon" href="/images/favicon.ico" />
-
+
<script src="/socket.io/socket.io.js"></script>
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
</head>
<body>
- <div class="container">
-
- <div class="sixteen columns alpha omega">
- <h1 class="remove-bottom">Nodebot</h1>
- <h5>A nodejs robot</h5>
- <hr/>
- <form>
- <input type="text" id="question" placeholder="Ask me something" />
- </form>
- <hr/.
- <div id="feed"></div>
- </div>
- <script src="/javascripts/nodebot.js"></script>
- </div>
+ <section>
+ <header>
+ <h1 class="remove-bottom">Nodebot</h1>
+ </header>
+
+ <div id="feed"></div>
+
+ <form>
+ <input type="text" id="question" placeholder="Ask me something" />
+ </form>
+
+ </section>
+ <script src="/javascripts/nodebot.js"></script>
</body>
</html>
View
@@ -19,6 +19,10 @@ app.log.info("Nodebot is listening on port", port);
// Install socket.io
Nodebot.io = require('socket.io').listen(app.server);
+Nodebot.io.configure(function() {
+ Nodebot.io.set('log level', 0);
+});
+
Nodebot.io.sockets.on('connection', function(socket) {
socket.emit('output', "Hello, master");
socket.on("input", function(d) {
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -1,9 +1,15 @@
$(document).ready(function() {
- var socket = io.connect('http://localhost');
+ var socket = io.connect(window.location.origin),
+ $feed = $("#feed");
socket.on("output", function (data) {
- $("<p/>").html("<strong>Nodebot:</strong> " + data).prependTo("#feed");
+ $("<p/>").html("<strong>Nodebot:</strong> " + data)
+ .css("opacity", 0)
+ .appendTo($feed)
+ .animate({ opacity : 1 });
+
+ $feed.animate({scrollTop : $feed.height() });
});
@@ -1,63 +0,0 @@
-/*
-* Skeleton V1.1
-* Copyright 2011, Dave Gamache
-* www.getskeleton.com
-* Free to use under the MIT license.
-* http://www.opensource.org/licenses/mit-license.php
-* 8/17/2011
-*/
-
-/* Table of Content
-==================================================
- #Site Styles
- #Page Styles
- #Media Queries
- #Font-Face */
-
-/* #Site Styles
-================================================== */
-
-/* #Page Styles
-================================================== */
-
-.container {
- padding-top: 1.5em;
-// @include grid-background();
-}
-
-/* #Media Queries
-================================================== */
-
- /* Smaller than standard 960 (devices and browsers) */
- @media only screen and (max-width: 959px) {}
-
- /* Tablet Portrait size to standard 960 (devices and browsers) */
- @media only screen and (min-width: 768px) and (max-width: 959px) {}
-
- /* All Mobile Sizes (devices and browser) */
- @media only screen and (max-width: 767px) {}
-
- /* Mobile Landscape Size to Tablet Portrait (devices and browsers) */
- @media only screen and (min-width: 480px) and (max-width: 767px) {}
-
- /* Mobile Portrait Size to Mobile Landscape Size (devices and browsers) */
- @media only screen and (max-width: 479px) {}
-
-
-/* #Font-Face
-================================================== */
-/* This is the proper syntax for an @font-face file
- Just create a "fonts" folder at the root,
- copy your FontName into code below and remove
- comment brackets */
-
-/* @font-face {
- font-family: 'FontName';
- src: url('../fonts/FontName.eot');
- src: url('../fonts/FontName.eot?iefix') format('eot'),
- url('../fonts/FontName.woff') format('woff'),
- url('../fonts/FontName.ttf') format('truetype'),
- url('../fonts/FontName.svg#webfontZam02nTh') format('svg');
- font-weight: normal;
- font-style: normal; }
-*/
@@ -1,66 +0,0 @@
-/*
-* Skeleton V1.1
-* Copyright 2011, Dave Gamache
-* www.getskeleton.com
-* Free to use under the MIT license.
-* http://www.opensource.org/licenses/mit-license.php
-* 8/17/2011
-*/
-
-/* Table of Content
-==================================================
- #Site Styles
- #Page Styles
- #Media Queries
- #Font-Face */
-
-/* #Site Styles
-================================================== */
-
-/* #Page Styles
-================================================== */
-
-body {
- padding-top: 60px;
-}
-
-.container {
-// @include grid-background();
-}
-
-/* #Media Queries
-================================================== */
-
- /* Smaller than standard 960 (devices and browsers) */
- @media only screen and (max-width: 959px) {}
-
- /* Tablet Portrait size to standard 960 (devices and browsers) */
- @media only screen and (min-width: 768px) and (max-width: 959px) {}
-
- /* All Mobile Sizes (devices and browser) */
- @media only screen and (max-width: 767px) {}
-
- /* Mobile Landscape Size to Tablet Portrait (devices and browsers) */
- @media only screen and (min-width: 480px) and (max-width: 767px) {}
-
- /* Mobile Portrait Size to Mobile Landscape Size (devices and browsers) */
- @media only screen and (max-width: 479px) {}
-
-
-/* #Font-Face
-================================================== */
-/* This is the proper syntax for an @font-face file
- Just create a "fonts" folder at the root,
- copy your FontName into code below and remove
- comment brackets */
-
-/* @font-face {
- font-family: 'FontName';
- src: url('../fonts/FontName.eot');
- src: url('../fonts/FontName.eot?iefix') format('eot'),
- url('../fonts/FontName.woff') format('woff'),
- url('../fonts/FontName.ttf') format('truetype'),
- url('../fonts/FontName.svg#webfontZam02nTh') format('svg');
- font-weight: normal;
- font-style: normal; }
-*/
@@ -15,7 +15,7 @@ body {
h1, h2, h3, h4, h5, h6 {
color: #181818;
- font-family: $serif;
+ font-family: $display;
font-weight: normal;
a {
@@ -0,0 +1,56 @@
+
+
+body {
+ background: #333 url("/images/dark_dotted.png");
+ padding-top: 60px;
+}
+
+section {
+ background:#d9d9d9 url("/images/brushed_alu.png");
+ margin: 0 auto;
+ padding: 10px;
+ width: 45%;
+
+ @include border-radius(3px);
+
+ header {
+ text-align: center;
+ }
+}
+
+p {
+ margin: 1em 0;
+}
+
+#feed {
+ background: #222;
+ border: 1px solid #111;
+ border-bottom: 0;
+ color: #fff;
+ height: 400px;
+ margin-top: 20px;
+ overflow-y: scroll;
+
+ padding: 1% 2%;
+ width: 96%;
+
+ @include box-shadow(inset 0 1px 3px rgba(0,0,0,0.45), 0 1px 1px rgba(255,255,255,0.75));
+ @include border-top-radius(3px);
+ strong {
+ color: #f0f0f0;
+ }
+
+}
+
+input[type="text"] {
+ background: #111;
+ border-color: transparent #111 #000;
+ color: #fff;
+ display: block;
+ margin: 0 auto;
+ position: relative;
+ width: 98.5%;
+
+ @include border-top-radius(0);
+
+}
@@ -29,5 +29,6 @@ $grid-background-column-color : rgba(100, 100, 100, 0.05);
// Typography
// -------------------------------------------------- //
+$display : "VT323", sans-serif;
$sans-serif : "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif;
$serif : "Georgia", "Times New Roman", Helvetica, Arial, sans-serif;
@@ -10,6 +10,8 @@
* 8/17/2011
*/
+@import url(http://fonts.googleapis.com/css?family=VT323);
+
@import "compass/css3";
@import "compass/layout";
@@ -51,4 +53,4 @@
// User Styles
// ================================================== //
-@import "layout";
+@import "partials/custom";
Oops, something went wrong.

0 comments on commit fa3fc9d

Please sign in to comment.