various cleanups

This commit is contained in:
Kai Hendry
2012-07-07 18:16:15 +02:00
parent 34207d4d91
commit 2436e95bd4
6 changed files with 18 additions and 40 deletions

View File

@@ -4,7 +4,7 @@
* Aim to [suck less](http://suckless.org) by keeping lines of code low
* Encourage folks to use `fetch-tweets.sh` themselves and get into shell ;)
* Dependencies: curl, libhtml-parser-perl (to decode HTML entities), xmlstarlet, coreutils, PHP
* Look and feel mostly by <http://twitter.github.com/bootstrap/>
* Look and feel mostly by <http://twitter.github.com/bootstrap>
* **Please** review and comment on the code!
# Known limitations
@@ -35,7 +35,6 @@ I did file <https://dev.twitter.com/discussions/3414>, which later seemed to be
<http://stackoverflow.com/a/9022823/4534>
Make sure your httpd does utf8 all the time:
# TODO
Make fetch-tweets.sh return nicer output like a % for <http://twitter.github.com/bootstrap/components.html#progress>
AddDefaultCharset utf-8

View File

@@ -48,7 +48,7 @@ cat <<END
<h1 class="alert alert-info">Fetching upto 3200 tweets from $id</h1>
<p class="help-inline">Please be patient. Closing this page prematurely you can limit the tweets <a href="https://github.com/kaihendry/Greptweet/blob/master/fetch-tweets.sh">fetch-tweets.sh</a> gets and trigger a locking bug.</p>
<p class="help-inline">Please be patient. Closing this page prematurely can limit the tweets <a href="https://github.com/kaihendry/Greptweet/blob/master/fetch-tweets.sh">fetch-tweets.sh</a> gets and trigger a locking bug.</p>
<pre>
END
@@ -90,11 +90,18 @@ echo "</pre>"
if test -s "$oldpwd/u/$id/$id.txt"
then
cd $oldpwd; ./users.sh > users.shtml
if echo $id | grep -q -v '_' # Underscores in domain names is a no no
then
mkdir /srv/www/$id.greptweet.com 2> /dev/null || true
echo Redirect / http://greptweet.com/u/$id > /srv/www/$id.greptweet.com/.htaccess
cat <<END
<a href="http://$id.greptweet.com"><h1 class="alert alert-success">Goto http://$id.greptweet.com to grep!</h1></a>
END
else
cat <<END
<a href="http://$HTTP_HOST/u/$id"><h1 class="alert alert-success">Goto http://$HTTP_HOST/u/$id to grep!</h1></a>
END
fi
else
rm -rf $oldpwd/u/$id

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# vim: set ts=4 sw=4
umask 002

View File

@@ -1,6 +0,0 @@
function submitPressed() {
if (document.forms.f.checkValidity()) {
$("#b").button('loading');
document.forms.f.submit();
}
}

View File

@@ -6,9 +6,6 @@
<meta content="width=device-width, initial-scale=1,maximum-scale=1.0;" name=viewport>
<link rel="stylesheet" href="/bootstrap/docs/assets/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="style.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="/bootstrap/js/bootstrap-button.js"></script>
<script src="index.js"></script>
</head>
<body>
@@ -31,25 +28,15 @@
</div>
</div>
<label class="checkbox">
<input type="checkbox" name="o">Fetch older tweets, instead of newer tweets when updating
</label>
<button class="btn btn-large btn-primary" id="b" data-loading-text="Fetching tweets..." onclick="submitPressed()">Fetch tweets</button>
<button class="btn btn-large btn-primary" id="b" onclick="submitPressed()">Fetch tweets</button>
</div>
</form>
<p><span class="label label-success">New</span> Try <a href="http://grepbook.co.uk/">Grepbook</a> for grepping Facebook</p>
<h3>Greppable tweeters</h3>
<!--#include virtual="users.shtml" -->
<p>Try <a href="http://grepbook.co.uk/">Grepbook</a> for grepping Facebook</p>
<footer>
<p>Please <a href="https://github.com/kaihendry/Greptweet">contribute to the source on Github</a> :)</p>
<p>Please <a href="https://github.com/kaihendry/Greptweet">contribute on Github</a> :)</p>
</footer>
</div>

View File

@@ -1,9 +0,0 @@
#!/bin/sh
echo "<ul id=\"users\">"
for i in `ls -cd u/*`
do
user=$(basename $i | cut -d'.' -f1)
test "$user" == 'www' && continue
echo "<li><a title=\"$(stat -c%z $i | awk '{print $1}')\" href=\"u/$user\">@${user}</a></li>"
done
echo "</ul>"