This repository has been archived by the owner on Jan 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
8 changed files
with
132 additions
and
19 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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.idea/ | ||
.vagrant/ | ||
node_modules/ | ||
temp/ |
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,22 @@ | ||
#!/usr/bin/env bash | ||
|
||
NPM_DIR="/usr/local/share/npm" | ||
|
||
echo "Provisioning: started..." | ||
echo "Current user is '$USER'" | ||
|
||
echo "Provisioning: Installing sass" | ||
gem install sass | ||
|
||
echo "Provisioning: Installing node" | ||
apt-get update | ||
apt-get install -y nodejs nodejs-legacy npm git | ||
|
||
echo "Provisioning: Installing yeoman and tumblr theme generator" | ||
npm config -g set prefix $NPM_DIR | ||
npm install --no-color -g yo grunt-cli generator-tumblr-theme | ||
chmod -R 775 $NPM_DIR && chown -R vagrant $NPM_DIR | ||
|
||
echo "export PATH=\"\$PATH:$NPM_DIR/bin\"" >> /home/vagrant/.bashrc | ||
|
||
echo "Provisioning: Complete." |
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 @@ | ||
# -*- mode: ruby -*- | ||
# vi: set ft=ruby : | ||
|
||
Vagrant.configure(2) do |config| | ||
config.vm.box = "ubuntu/trusty32" | ||
config.vm.network "public_network" | ||
config.vm.provision :shell, path: ".vagrant-provision.sh" | ||
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
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
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 @@ | ||
/** | ||
* Spottr | ||
* | ||
* A tumblr blog proxy that converts XML tumblr logs to JSON | ||
* @author ffffranklin | ||
*/ | ||
|
||
var PORT = 8080; | ||
var http = require('http'); | ||
|
||
http.createServer(function (req, res) { | ||
|
||
var url; | ||
|
||
|
||
// check if url path starts with content and has a character after it | ||
if (req.url.match(/^\/content\/\S+/)) { | ||
|
||
// returns [1] as undefined if no greater than 0 in length | ||
url = req.url.match('^/content\/(.*){0,}')[1]; | ||
|
||
if (url) { | ||
|
||
console.log('Spottr: Requesting source of "%s"', url); | ||
|
||
http.get('http://' + url, function (response) { | ||
|
||
res.writeHeader(200, {"Content-Type": "text/plain"}); | ||
|
||
console.log('Spottr: Response received with status code %s', response.statusCode); | ||
|
||
if (response.statusCode === 200) { | ||
response.setEncoding('utf8'); | ||
response.on('data', function (chunk) { | ||
res.write(chunk); | ||
}); | ||
response.on('end', function () { | ||
// TODO make sure to end response if this 'end' event never happens | ||
res.end(); | ||
}) | ||
} else { | ||
res.write('Didn\'t work'); | ||
res.end(); | ||
} | ||
}).on('error', function (e) { | ||
console.log('Got error: ' + e.message); | ||
}); | ||
|
||
} | ||
} else { | ||
res.write('404'); | ||
res.end(); | ||
} | ||
|
||
}).listen(PORT); | ||
|
||
console.log('Spottr: Created Server "http://localhost:%s"', PORT); | ||
|
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
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