Skip to content

Instantly share code, notes, and snippets.

@skorgu
Created January 13, 2010 00:23
Show Gist options
  • Save skorgu/275785 to your computer and use it in GitHub Desktop.
Save skorgu/275785 to your computer and use it in GitHub Desktop.
#!/usr/bin/sh
sudo apt-get install php5-cli
wget -c http://www.symfony-project.org/get/symfony-1.4.1.tgz
mkdir in_symfony/lib/vendor/ -p
tar xzvf symfony-1.4.1.tgz -C in_symfony/lib/vendor/
mv in_symfony/lib/vendor/symfony-1.4.1/ in_symfony/lib/vendor/symfony
cd in_symfony
php lib/vendor/symfony/data/bin/symfony generate:project marginalmemory
php symfony generate:app frontend
php symfony generate:module frontend mm
cat << EOF > apps/frontend/modules/mm/actions/actions.class.php
<?php
/**
* mm actions.
*
* @package marginalmemory
* @subpackage mm
* @author Your name here
* @version SVN: \$Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
*/
class mmActions extends sfActions
{
/**
* Executes index action
*
* @param sfRequest \$request A request object
*/
public function executeIndex(sfWebRequest \$request)
{
\$this->date = date("Y-m-d H:i:s O");
}
}
EOF
cat << EOF > apps/frontend/modules/mm/templates/indexSuccess.php
Hello World! Today is <?= \$date ?>. Do you believe PHP can't generate ISO 8601 easily?
EOF
sed -i 's#die#//die#' web/frontend_dev.php
echo "I suggest setting up proper webserver settings to the non-dev mode (http://www.symfony-project.org/getting-started/1_4/en/05-Web-Server-Configuration) for actual testing."
echo "But to make sure it actually works just link in_symfony/web in your htdocs somewhere and hit http://hostname/path/to/symfony/web/frontend_dev.php/mm"
#!/usr/bin/sh
sudo apt-get install python-setuptools python-dev python-pycurl python-simplejson
sudo easy_install tornado
cat <<EOF > mm.py
import tornado.httpserver
import tornado.ioloop
import tornado.web
import datetime
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello, world. Today is %s" % datetime.datetime.now().isoformat())
application = tornado.web.Application([
(r"/", MainHandler),
])
if __name__ == "__main__":
http_server = tornado.httpserver.HTTPServer(application)
http_server.listen(8888)
tornado.ioloop.IOLoop.instance().start()
EOF
echo "Tornado template example listening at 0.0.0.0:8888"
python mm.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment