Skip to content

Commit

Permalink
Cleaned the shit up a little, it was fucking with my ocd
Browse files Browse the repository at this point in the history
  • Loading branch information
insaindesign committed Oct 13, 2011
1 parent c16e400 commit bf411fb
Show file tree
Hide file tree
Showing 12 changed files with 252 additions and 36 deletions.
2 changes: 1 addition & 1 deletion meetings.js → data/meetings.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ meetings.sort(function (a, b) {
return ad == bd ? 0 : ad < bd ? -1 : 1; return ad == bd ? 0 : ad < bd ? -1 : 1;
}); });


exports.meetings = meetings; exports.meetings = meetings;
File renamed without changes.
205 changes: 205 additions & 0 deletions docs/sydjslogo.ai

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/sydjslogo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 24 additions & 13 deletions server.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -7,33 +7,39 @@ var fs = require("fs"),
process.env.TZ = "Australia/Sydney"; process.env.TZ = "Australia/Sydney";


require("http").createServer(function (req, res) { require("http").createServer(function (req, res) {

var name = url.parse(req.url).pathname; var name = url.parse(req.url).pathname;
//fix up the names
name == "/" && (name = "/index.html"); 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 // Heroku timezone testing
if (name == "/timetest") { if (name == "/timetest") {
var now = new Date; 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.writeHead(200, {"Content-Type": "text/html"});
res.write(content, "utf8"); res.write(content, "utf8");
res.end(); res.end();
} }
// End Heroku timezone testing // End Heroku timezone testing


var ext = name.substring(name.lastIndexOf(".") + 1); //serve static file
fs.stat(fullPath, function (err, stats) { fs.stat(fullPath, function (err, stats) {
if (!err && stats.isFile()) { if (!err && stats.isFile()) {
fs.readFile(fullPath, encoding[ext] || "binary", function (err, data) { fs.readFile(fullPath, encoding[ext] || "binary", function (err, data) {
if (err) { if (err) {
res.writeHead(500, {"Content-Type": "text/html"}); res.writeHead(500, {"Content-Type": "text/html"});
res.end(p500 + err); res.end(p500 + err);
} }
res.writeHead(200, {"Content-Type": types[ext] || "text/plain"}); res.writeHead(200, {"Content-Type": types[ext] || "text/plain"});
if(!req.method.match(/head/i)){ if (!req.method.match(/head/i)) {
if (name == "/index.html") { if (name === "/index.html") {
data = parseSpeakers(data); data = parseMeetings(data);
} }
res.write(data, encoding[ext] || 'binary'); res.write(data, encoding[ext] || 'binary');
} }
Expand All @@ -46,8 +52,11 @@ require("http").createServer(function (req, res) {
}); });
}).listen(parseInt(process.env.PORT || 8001, 10)); }).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, index = meetings.length,
meeting, meeting,
startTime, startTime,
Expand All @@ -66,7 +75,9 @@ function parseSpeakers(data) {
} }
current = meeting; 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) { .replace(/\{\{templatestart\}\}([\s\S]*?)\{\{templateend\}\}/, function (match, template) {
var html = [], var html = [],
section, section,
Expand Down Expand Up @@ -179,4 +190,4 @@ var encoding = {
txt : "utf8", txt : "utf8",
xhtml : "utf8", xhtml : "utf8",
zip : "binary" zip : "binary"
}; };
File renamed without changes
Binary file added static/favicon.ico
Binary file not shown.
File renamed without changes.
File renamed without changes.
18 changes: 18 additions & 0 deletions static/style.css
Original file line number Original file line Diff line number Diff line change
@@ -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;
}
File renamed without changes.
25 changes: 3 additions & 22 deletions index.html → views/index.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3,34 +3,15 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>SydJS &mdash; JavaScript in Sydney has a new home</title> <title>SydJS &mdash; JavaScript in Sydney has a new home</title>
<style type="text/css" media="screen"> <link type="text/css" rel="stylesheet" href="style.css">
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>
</head> </head>
<body class="no-raphael no-js"> <body class="no-raphael no-js">
<div id="content" class="vevent"> <div id="content" class="vevent">
<h1 class="summary">Sydney JavaScript Group</h1> <h1 class="summary">Sydney JavaScript Group</h1>
<h2 id="next">Next Meeting:</h2> <h2 id="next">Next Meeting:</h2>
<dl> <dl>
<dt>When:</dt> <dt>When:</dt>
<dd id="when" class="dtstart">{{datetime}}</dd> <dd id="when" class="dtstart" class="value" title="{{datevalue}}">{{datetime}}</dd>
<dt>Who:</dt> <dt>Who:</dt>
<dd> <dd>
<dl> <dl>
Expand Down Expand Up @@ -60,7 +41,7 @@ <h2 id="group">The Group</h2>
</dd> </dd>
</dl> </dl>
</div> </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="raphael.js"></script>
<script src="museo.js"></script> <script src="museo.js"></script>
<script src="syd.js"></script> <script src="syd.js"></script>
Expand Down

0 comments on commit bf411fb

Please sign in to comment.