Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 64c58ca
Showing
51 changed files
with
4,682 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"template_dir": "templates", | ||
"content_dir": "contents", | ||
"output_dir": "public", | ||
|
||
"server": { | ||
"port": 9009 | ||
}, | ||
|
||
"plugins": { | ||
"content_handler": "./favtweet_content_handler.js", | ||
|
||
"helpers": { | ||
"site_heleprs": "./site_helpers.js" | ||
}, | ||
|
||
"template_engine": "punch-engine-handlebars" | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
var util = require("util"); | ||
var http = require("http"); | ||
|
||
module.exports = { | ||
|
||
isSection: function(basepath) { | ||
if (basepath === "/") { | ||
return true | ||
} | ||
return false; | ||
}, | ||
|
||
negotiateContent: function(basepath, file_extension, options, callback) { | ||
var self = this; | ||
|
||
// if index is requested, | ||
// serve a blank object | ||
if (basepath === "/index") { | ||
return callback(null, {}, null, {}); | ||
} | ||
|
||
var username = basepath.substr(1); | ||
|
||
var options = { | ||
host: "api.twitter.com", | ||
path: util.format("/1/favorites.json?count=20&screen_name=%s", username), | ||
method: "GET" | ||
}; | ||
|
||
var req = http.request(options, function(res) { | ||
var full_body = ""; | ||
|
||
res.setEncoding('utf8'); | ||
|
||
res.on('data', function (chunk) { | ||
full_body += chunk; | ||
}); | ||
|
||
res.on('end', function(){ | ||
var tweets_obj = JSON.parse(full_body); | ||
return callback(null, { "user": username, "tweets": tweets_obj }, {}, new Date().getTime()); | ||
}); | ||
}); | ||
|
||
req.on('error', function(e) { | ||
console.log("Error occurred when connecting to Twitter API: " + e.message); | ||
return callback(util.format("[Error: %s]", e.message), null, null, {}); | ||
}); | ||
|
||
req.end(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
var getRandomInt = function(min, max) { | ||
return Math.floor(Math.random() * (max - min + 1)) + min; | ||
} | ||
|
||
module.exports = { | ||
|
||
get: function(basepath, content_type, request_options, callback) { | ||
var self = this; | ||
var response_options = { "header": {} }; | ||
|
||
if (basepath === "/index") { | ||
response_options.header["Set-Cookie"] = "bg=" + getRandomInt(0, 1); | ||
return callback(null, { "index": true }, {}, response_options); | ||
} else { | ||
return callback(null, { "index": false }, {}, response_options); | ||
} | ||
} | ||
|
||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<div class="content"> | ||
<h1>{{#titleize}}{{user}}'s Favorities{{/titleize}}</h1> | ||
|
||
<div class="tweets"> | ||
{{#tweets}} | ||
<div class="tweet"> | ||
<div class="avatar"> | ||
<a href="http://twitter.com/{{user.screen_name}}"><img src="{{user.profile_image_url}}" alt="profile image"></a> | ||
</div> | ||
<div class="details"> | ||
<h4><strong>{{user.name}}</strong> <a href="http://twitter.com/{{user.screen_name}}">@{{user.screen_name}}</a></h4> | ||
<p> | ||
{{text}} | ||
<span><a href="http://twitter.com/{{user.screen_name}}/status/{{id}}">{{date created_at}}</a></span> | ||
</p> | ||
</div> | ||
</div> | ||
{{/tweets}} | ||
{{^tweets}} | ||
<p>Sorry, no favorites here.</p> | ||
{{/tweets}} | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<div class="bg-image"></div> | ||
|
||
<footer> | ||
<p>Background image courtesy of <a class="bg-img-attributes" href="#"></a> | Built using <a href="http://laktek.github.com/punch">Punch</a></p> | ||
</footer> | ||
|
||
<!-- Le javascript | ||
================================================== --> | ||
<!-- Placed at the end of the document so the pages load faster --> | ||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> | ||
<script src="/js/cookies.js"></script> | ||
<script src="/js/site.js"></script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>FavTweet</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta name="description" content=""> | ||
<meta name="author" content=""> | ||
|
||
<!-- Le styles --> | ||
<link href="/css/bootstrap.css" rel="stylesheet"> | ||
<style> | ||
body { | ||
padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */ | ||
} | ||
</style> | ||
<link href="/css/responsive.css" rel="stylesheet"> | ||
|
||
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements --> | ||
<!--[if lt IE 9]> | ||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> | ||
<![endif]--> | ||
|
||
<!-- Le fav and touch icons --> | ||
<link rel="shortcut icon" href="favicon.ico"> | ||
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="apple-touch-icon-144-precomposed.png"> | ||
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="apple-touch-icon-114-precomposed.png"> | ||
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="apple-touch-icon-72-precomposed.png"> | ||
<link rel="apple-touch-icon-precomposed" href="apple-touch-icon-57-precomposed.png"> | ||
</head> | ||
|
||
<body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{{> header }} | ||
|
||
<div class="column"> | ||
{{#if index}} | ||
{{> splash }} | ||
{{else}} | ||
{{> content }} | ||
{{/if}} | ||
</div> | ||
|
||
{{> footer }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<div class="splash"> | ||
<h1>FavTweet</h1> | ||
<p>Discover favorite tweets of your friends.</p> | ||
<div class="form-controls"> | ||
<input id="usernameField" size="16" type="text" placeholder="@username"> | ||
<button class="btn btn-large btn-primary" id="fetch_tweets" type="button">Go!</button> | ||
</div> | ||
</div> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// ALERT STYLES | ||
// ------------ | ||
|
||
// Base alert styles | ||
.alert { | ||
padding: 8px 35px 8px 14px; | ||
margin-bottom: @baseLineHeight; | ||
text-shadow: 0 1px 0 rgba(255,255,255,.5); | ||
background-color: @warningBackground; | ||
border: 1px solid @warningBorder; | ||
.border-radius(4px); | ||
color: @warningText; | ||
} | ||
.alert-heading { | ||
color: inherit; | ||
} | ||
|
||
// Adjust close link position | ||
.alert .close { | ||
position: relative; | ||
top: -2px; | ||
right: -21px; | ||
line-height: 18px; | ||
} | ||
|
||
// Alternate styles | ||
// ---------------- | ||
|
||
.alert-success { | ||
background-color: @successBackground; | ||
border-color: @successBorder; | ||
color: @successText; | ||
} | ||
.alert-danger, | ||
.alert-error { | ||
background-color: @errorBackground; | ||
border-color: @errorBorder; | ||
color: @errorText; | ||
} | ||
.alert-info { | ||
background-color: @infoBackground; | ||
border-color: @infoBorder; | ||
color: @infoText; | ||
} | ||
|
||
// Block alerts | ||
// ------------------------ | ||
.alert-block { | ||
padding-top: 14px; | ||
padding-bottom: 14px; | ||
} | ||
.alert-block > p, | ||
.alert-block > ul { | ||
margin-bottom: 0; | ||
} | ||
.alert-block p + p { | ||
margin-top: 5px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/*! | ||
* Bootstrap v2.0.4 | ||
* | ||
* Copyright 2012 Twitter, Inc | ||
* Licensed under the Apache License v2.0 | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Designed and built with all the love in the world @twitter by @mdo and @fat. | ||
* | ||
* Modified for FavTweet Example by @laktek. | ||
*/ | ||
|
||
// CSS Reset | ||
@import "reset.less"; | ||
|
||
// Core variables and mixins | ||
@import "variables.less"; // Modify this for custom colors, font-sizes, etc | ||
@import "mixins.less"; | ||
|
||
// Grid system and page structure | ||
@import "scaffolding.less"; | ||
@import "grid.less"; | ||
@import "layouts.less"; | ||
|
||
// Base CSS | ||
@import "type.less"; | ||
@import "code.less"; | ||
@import "forms.less"; | ||
@import "tables.less"; | ||
|
||
// Components: common | ||
@import "sprites.less"; | ||
@import "dropdowns.less"; | ||
@import "wells.less"; | ||
|
||
// Components: Buttons & Alerts | ||
@import "buttons.less"; | ||
@import "button-groups.less"; | ||
@import "alerts.less"; // Note: alerts share common CSS with buttons and thus have styles in buttons.less | ||
|
||
// Components: Nav | ||
@import "navs.less"; | ||
@import "navbar.less"; | ||
|
||
// Components: Popovers | ||
@import "modals.less"; | ||
@import "tooltip.less"; | ||
@import "popovers.less"; | ||
|
||
// Components: Misc | ||
@import "labels-badges.less"; | ||
@import "hero-unit.less"; | ||
|
||
// Site specific | ||
@import "site.less"; | ||
|
||
// Utility classes | ||
@import "utilities.less"; // Has to be last to override when necessary |
Oops, something went wrong.