Permalink
Browse files

cssify web! using google app engine

  • Loading branch information...
1 parent 08cb064 commit 00c2aa85e70e1b2fdcc70ed1456065c0adf616cf @santiycr committed Jan 10, 2012
Showing with 399 additions and 0 deletions.
  1. +183 −0 app.yaml
  2. +11 −0 index.yaml
  3. +47 −0 main.py
  4. +83 −0 static/index.css
  5. +36 −0 static/index.html
  6. +39 −0 static/index.js
View
183 app.yaml
@@ -0,0 +1,183 @@
+application: cssify
+version: 1
+runtime: python
+api_version: 1
+
+default_expiration: "30d"
+
+handlers:
+- url: /favicon\.ico
+ static_files: favicon.ico
+ upload: favicon\.ico
+
+- url: /(.*\.(appcache|manifest))
+ mime_type: text/cache-manifest
+ static_files: static/\1
+ upload: static/(.*\.(appcache|manifest))
+ expiration: "0m"
+
+- url: /(.*\.atom)
+ mime_type: application/atom+xml
+ static_files: static/\1
+ upload: static/(.*\.atom)
+ expiration: "1h"
+
+- url: /(.*\.crx)
+ mime_type: application/x-chrome-extension
+ static_files: static/\1
+ upload: static/(.*\.crx)
+
+- url: /(.*\.css)
+ mime_type: text/css
+ static_files: static/\1
+ upload: static/(.*\.css)
+
+- url: /(.*\.eot)
+ mime_type: application/vnd.ms-fontobject
+ static_files: static/\1
+ upload: static/(.*\.eot)
+
+- url: /(.*\.htc)
+ mime_type: text/x-component
+ static_files: static/\1
+ upload: static/(.*\.htc)
+
+- url: /(.*\.html)
+ mime_type: text/html
+ static_files: static/\1
+ upload: static/(.*\.html)
+ expiration: "1h"
+
+- url: /(.*\.ico)
+ mime_type: image/x-icon
+ static_files: static/\1
+ upload: static/(.*\.ico)
+ expiration: "7d"
+
+- url: /(.*\.js)
+ mime_type: text/javascript
+ static_files: static/\1
+ upload: static/(.*\.js)
+
+- url: /(.*\.json)
+ mime_type: application/json
+ static_files: static/\1
+ upload: static/(.*\.json)
+ expiration: "1h"
+
+- url: /(.*\.m4v)
+ mime_type: video/m4v
+ static_files: static/\1
+ upload: static/(.*\.m4v)
+
+- url: /(.*\.mp4)
+ mime_type: video/mp4
+ static_files: static/\1
+ upload: static/(.*\.mp4)
+
+- url: /(.*\.(ogg|oga))
+ mime_type: audio/ogg
+ static_files: static/\1
+ upload: static/(.*\.(ogg|oga))
+
+- url: /(.*\.ogv)
+ mime_type: video/ogg
+ static_files: static/\1
+ upload: static/(.*\.ogv)
+
+- url: /(.*\.otf)
+ mime_type: font/opentype
+ static_files: static/\1
+ upload: static/(.*\.otf)
+
+- url: /(.*\.rss)
+ mime_type: application/rss+xml
+ static_files: static/\1
+ upload: static/(.*\.rss)
+ expiration: "1h"
+
+- url: /(.*\.safariextz)
+ mime_type: application/octet-stream
+ static_files: static/\1
+ upload: static/(.*\.safariextz)
+
+- url: /(.*\.(svg|svgz))
+ mime_type: images/svg+xml
+ static_files: static/\1
+ upload: static/(.*\.(svg|svgz))
+
+- url: /(.*\.swf)
+ mime_type: application/x-shockwave-flash
+ static_files: static/\1
+ upload: static/(.*\.swf)
+
+- url: /(.*\.ttf)
+ mime_type: font/truetype
+ static_files: static/\1
+ upload: static/(.*\.ttf)
+
+- url: /(.*\.txt)
+ mime_type: text/plain
+ static_files: static/\1
+ upload: static/(.*\.txt)
+
+- url: /(.*\.unity3d)
+ mime_type: application/vnd.unity
+ static_files: static/\1
+ upload: static/(.*\.unity3d)
+
+- url: /(.*\.webm)
+ mime_type: video/webm
+ static_files: static/\1
+ upload: static/(.*\.webm)
+
+- url: /(.*\.webp)
+ mime_type: image/webp
+ static_files: static/\1
+ upload: static/(.*\.webp)
+
+- url: /(.*\.woff)
+ mime_type: application/x-font-woff
+ static_files: static/\1
+ upload: static/(.*\.woff)
+
+- url: /(.*\.xml)
+ mime_type: application/xml
+ static_files: static/\1
+ upload: static/(.*\.xml)
+ expiration: "1h"
+
+- url: /(.*\.xpi)
+ mime_type: application/x-xpinstall
+ static_files: static/\1
+ upload: static/(.*\.xpi)
+
+# image files
+- url: /(.*\.(bmp|gif|ico|jpeg|jpg|png))
+ static_files: static/\1
+ upload: static/(.*\.(bmp|gif|ico|jpeg|jpg|png))
+
+# audio files
+- url: /(.*\.(mid|midi|mp3|wav))
+ static_files: static/\1
+ upload: static/(.*\.(mid|midi|mp3|wav))
+
+# windows files
+- url: /(.*\.(doc|exe|ppt|rtf|xls))
+ static_files: static/\1
+ upload: static/(.*\.(doc|exe|ppt|rtf|xls))
+
+# compressed files
+- url: /(.*\.(bz2|gz|rar|tar|tgz|zip))
+ static_files: static/\1
+ upload: static/(.*\.(bz2|gz|rar|tar|tgz|zip))
+
+# site root
+- url: /
+ static_files: static/index.html
+ upload: static/index.html
+ expiration: "15m"
+
+- url: .*
+ script: main.py
+
View
@@ -0,0 +1,11 @@
+indexes:
+
+# AUTOGENERATED
+
+# This index.yaml is automatically updated whenever the dev_appserver
+# detects that a new type of query is run. If you want to manage the
+# index.yaml file manually, remove the above marker line (the line
+# saying "# AUTOGENERATED"). If you want to manage some indexes
+# manually, move them above the marker line. The index.yaml file is
+# automatically uploaded to the admin console when you next deploy
+# your application using appcfg.py.
View
47 main.py
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+#
+# Copyright 2007 Google Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+from google.appengine.ext import webapp
+from google.appengine.ext.webapp import util
+from cssify import cssify, XpathException
+import simplejson as json
+
+class MainHandler(webapp.RequestHandler):
+ def post(self):
+ xpath = self.request.get('xpath')
+ if xpath:
+ self.response.headers['Content-Type'] = 'application/json'
+ try:
+ css = cssify(xpath)
+ except XpathException, e:
+ self.response.out.write(json.dumps({'status': 'fail', 'response': str(e)}))
+ else:
+ self.response.out.write(json.dumps({'status': 'pass', 'response': css}))
+ else:
+ self.response.out.write("Send your xpath via POST under the xpath param")
+
+ def get(self):
+ self.response.out.write("Send your xpath via POST under the xpath param")
+
+
+def main():
+ application = webapp.WSGIApplication([('/cssify', MainHandler)],
+ debug=True)
+ util.run_wsgi_app(application)
+
+
+if __name__ == '__main__':
+ main()
View
@@ -0,0 +1,83 @@
+#main{
+ width:700px;
+ margin: 0 auto;
+}
+
+.drop-shadow {
+ position:relative;
+ float:left;
+ padding:1em;
+ margin:2em 10px 4em;
+ background:#fff;
+ -webkit-box-shadow:0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;
+ -moz-box-shadow:0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;
+ box-shadow:0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;
+}
+
+.drop-shadow:before,
+.drop-shadow:after {
+ content:"";
+ position:absolute;
+ z-index:-2;
+}
+
+.drop-shadow p {
+ font-size:16px;
+}
+
+
+.lifted {
+ -moz-border-radius:4px;
+ border-radius:4px;
+}
+
+.lifted:before,
+.lifted:after {
+ bottom:15px;
+ left:10px;
+ width:50%;
+ height:20%;
+ max-width:300px;
+ -webkit-box-shadow:0 15px 10px rgba(0, 0, 0, 0.7);
+ -moz-box-shadow:0 15px 10px rgba(0, 0, 0, 0.7);
+ box-shadow:0 15px 10px rgba(0, 0, 0, 0.7);
+ -webkit-transform:rotate(-3deg);
+ -moz-transform:rotate(-3deg);
+ -ms-transform:rotate(-3deg);
+ -o-transform:rotate(-3deg);
+ transform:rotate(-3deg);
+}
+
+.lifted:after {
+ right:10px;
+ left:auto;
+ -webkit-transform:rotate(3deg);
+ -moz-transform:rotate(3deg);
+ -ms-transform:rotate(3deg);
+ -o-transform:rotate(3deg);
+ transform:rotate(3deg);
+}
+#xpath {
+ width: 500px;
+}
+#response {
+ margin: 3px;
+}
+#response #css {
+ margin-left: 10px;
+ border: none;
+ font-size: 1.1em;
+}
+#response.fail {
+ color: red;
+}
+a#repo-link {
+ margin-top: 30px;
+ font-size: .8em;
+ float: right;
+}
+a#santi-link {
+ margin-top: 30px;
+ font-size: .8em;
+ float: left;
+}
View
@@ -0,0 +1,36 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <meta name="description" content="cssify will convert your xpaths into a nice and clean css version">
+ <meta name="author" content="Santiago Suarez Ordo&ntilde;ez">
+ <title>cssify</title>
+ <link href='http://fonts.googleapis.com/css?family=Muli:400,400italic' rel='stylesheet' type='text/css'>
+ <link href="index.css" rel="stylesheet" />
+ <!--[if lt IE 9]>
+ <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+ <script src="scripts/innershiv.min.js"></script>
+ <![endif]-->
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
+ <script src="index.js" type="text/javascript"></script>
+ </head>
+ <body>
+ <a href="https://github.com/santiycr/cssify"><img style="position: absolute; top: 0; left: 0; border: 0;" src="https://a248.e.akamai.net/assets.github.com/img/ce742187c818c67d98af16f96ed21c00160c234a/687474703a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f6c6566745f677261795f3664366436642e706e67" alt="Fork me on GitHub"></a>
+
+ <div id="main">
+ <div style="font-family: 'Muli', sans-serif;" class="lifted drop-shadow">
+ <h1>cssify</h1>
+ <p>
+ Hi, welcome to <i>cssify</i>.<br>
+ Just write your xpath in here and I'll tell you its css version<br>
+ </p>
+ <form action="/cssify" id="cssify-form" method="post">
+ <input type="text" id="xpath" value="" name="xpath" placeholder="your xpath"/>
+ <input type="submit" name="submit" value="submit" />
+ </form>
+ <div id="response"></div>
+ <a id="repo-link" href="https://github.com/santiycr/cssify">Source code</a>
+ <a id="santi-link" href="http://www.santiycr.com">Santiago Suarez Ordo&ntilde;ez</a>
+ </div>
+ </body>
+</html>
Oops, something went wrong.

0 comments on commit 00c2aa8

Please sign in to comment.