Permalink
Browse files

Cleaned the shit up a little, it was fucking with my ocd

  • Loading branch information...
1 parent c16e400 commit bf411fb08c7b575c85da67ebb5bee3aa65f4a071 @insaindesign insaindesign committed Oct 13, 2011
@@ -65,4 +65,4 @@ meetings.sort(function (a, b) {
return ad == bd ? 0 : ad < bd ? -1 : 1;
});
-exports.meetings = meetings;
+exports.meetings = meetings;
File renamed without changes.
View

Large diffs are not rendered by default.

Oops, something went wrong.
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -7,33 +7,39 @@ var fs = require("fs"),
process.env.TZ = "Australia/Sydney";
require("http").createServer(function (req, res) {
+
var name = url.parse(req.url).pathname;
+ //fix up the names
name == "/" && (name = "/index.html");
- var fullPath = path.join(process.cwd(), process.argv[2] || "", name),
- content;
+
+ //what file you want?
+ var prepath = path.join(process.cwd(), process.argv[2] || ""),
+ ext = name.substring(name.lastIndexOf(".") + 1),
+ //routing for static files
+ fullPath = (ext !== 'html') ? path.join(prepath, 'static', name) : path.join(prepath, 'views', name);
// Heroku timezone testing
if (name == "/timetest") {
var now = new Date;
- content = "<h1>Server</h1><p>Rel: " + now.toString() + "</p><p>Abs: " + now.toUTCString() + "</p>";
+ var content = "<h1>Server</h1><p>Rel: " + now.toString() + "</p><p>Abs: " + now.toUTCString() + "</p>";
res.writeHead(200, {"Content-Type": "text/html"});
res.write(content, "utf8");
res.end();
}
// End Heroku timezone testing
- var ext = name.substring(name.lastIndexOf(".") + 1);
- fs.stat(fullPath, function (err, stats) {
- if (!err && stats.isFile()) {
+ //serve static file
+ fs.stat(fullPath, function (err, stats) {
+ if (!err && stats.isFile()) {
fs.readFile(fullPath, encoding[ext] || "binary", function (err, data) {
if (err) {
res.writeHead(500, {"Content-Type": "text/html"});
res.end(p500 + err);
}
res.writeHead(200, {"Content-Type": types[ext] || "text/plain"});
- if(!req.method.match(/head/i)){
- if (name == "/index.html") {
- data = parseSpeakers(data);
+ if (!req.method.match(/head/i)) {
+ if (name === "/index.html") {
+ data = parseMeetings(data);
}
res.write(data, encoding[ext] || 'binary');
}
@@ -46,8 +52,11 @@ require("http").createServer(function (req, res) {
});
}).listen(parseInt(process.env.PORT || 8001, 10));
-function parseSpeakers(data) {
- var meetings = require("./meetings").meetings,
+
+
+
+function parseMeetings(data) {
+ var meetings = require("./data/meetings").meetings,
index = meetings.length,
meeting,
startTime,
@@ -66,7 +75,9 @@ function parseSpeakers(data) {
}
current = meeting;
}
- data = data.replace("{{datetime}}", current.date)
+ startTime = new Date(current.date);
+ data = data.replace("{{datetime}}", startTime.toString())
+ .replace('{{datevalue}}', current.date + '+' + (-startTime.getTimezoneOffset()*10/6))
.replace(/\{\{templatestart\}\}([\s\S]*?)\{\{templateend\}\}/, function (match, template) {
var html = [],
section,
@@ -179,4 +190,4 @@ var encoding = {
txt : "utf8",
xhtml : "utf8",
zip : "binary"
-};
+};
File renamed without changes
View
Binary file not shown.
File renamed without changes.
File renamed without changes.
View
@@ -0,0 +1,18 @@
+ body {
+ background: #2c53b0 url(blueprintbg.png);
+ font-family: "Helvetica Neue",Arial,sans-serif;
+ color: #fff;
+ }
+ a:link, a:visited {
+ color: #fff;
+ }
+ .js #content {
+ position: absolute;
+ left: -9999em;
+ top: -9999em;
+ }
+ .no-raphael #content {
+ position: initial;
+ left: initial;
+ top: initial;
+ }
View
File renamed without changes.
@@ -3,34 +3,15 @@
<head>
<meta charset="utf-8">
<title>SydJS &mdash; JavaScript in Sydney has a new home</title>
- <style type="text/css" media="screen">
- body {
- background: #2c53b0 url(blueprintbg.png);
- font-family: "Helvetica Neue",Arial,sans-serif;
- color: #fff;
- }
- a:link, a:visited {
- color: #fff;
- }
- .js #content {
- position: absolute;
- left: -9999em;
- top: -9999em;
- }
- .no-raphael #content {
- position: initial;
- left: initial;
- top: initial;
- }
- </style>
+ <link type="text/css" rel="stylesheet" href="style.css">
</head>
<body class="no-raphael no-js">
<div id="content" class="vevent">
<h1 class="summary">Sydney JavaScript Group</h1>
<h2 id="next">Next Meeting:</h2>
<dl>
<dt>When:</dt>
- <dd id="when" class="dtstart">{{datetime}}</dd>
+ <dd id="when" class="dtstart" class="value" title="{{datevalue}}">{{datetime}}</dd>
<dt>Who:</dt>
<dd>
<dl>
@@ -60,7 +41,7 @@ <h2 id="group">The Group</h2>
</dd>
</dl>
</div>
- <script>document.body.className = document.body.className.replace(/\bno-js\b/,'js');</script>
+ <script>document.body.className = document.body.className.replace(/\bno-js\b/,'js');</script>
<script src="raphael.js"></script>
<script src="museo.js"></script>
<script src="syd.js"></script>

0 comments on commit bf411fb

Please sign in to comment.