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
import unittest, os, os.path, sys | |
import tornado.database | |
import tornado.options | |
from tornado.options import options | |
APP_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) | |
sys.path.append(os.path.join(APP_ROOT, '..')) | |
# import your model module | |
import your.model as model |
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
<div id="main-container"> | |
<div id="main"> | |
<h1> | |
<img alt="scubabook logo" src="{{ static_url("img/logo.png") }}"> | |
</h1> | |
<div id="login-form"> | |
<form action="/auth/login/" method="post" id="login_form"> | |
<fieldset> | |
<label for="username">Username</label> | |
<input autocapitalize="off" autocorrect="off" class="text-input" id="username" name="username" tabindex="1" type="text" value=""> |
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
#!/usr/bin/python | |
import os | |
virtenv = os.environ['APPDIR'] + '/virtenv/' | |
os.environ['PYTHON_EGG_CACHE'] = os.path.join(virtenv, 'lib/python2.6/site-packages') | |
virtualenv = os.path.join(virtenv, 'bin/activate_this.py') | |
try: | |
execfile(virtualenv, dict(__file__=virtualenv)) | |
except IOError: | |
pass |
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
<?php | |
/** | |
* Payoneer API integration | |
* | |
* @date 27/11/12 | |
* @name $payoneer | |
* @author Panagiotis Moustafellos | |
*/ | |
class Payoneer | |
{ |
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
#news handler, pulls news from mongodb, renders news page | |
class NewsHandler (tornado.web.RequestHandler): | |
def get(self, currentPage): | |
news_content = dict() | |
coll = self.application.db.news | |
news = coll.find().sort("_id", DESCENDING) | |
#pagination code | |
currentPage = int(currentPage) | |
newsItemsPerPage = 2 |
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
from bs4 import BeautifulSoup | |
import requests | |
r = requests.get("http://www.metmuseum.org/collection/the-collection-online/search/36484") | |
bs = BeautifulSoup(r.content) | |
imgs = bs.findAll('img', src=True) | |
for img in imgs: | |
print img['src'] |
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
{% extends "main.html" %} | |
{% autoescape None %} | |
{% block body %} | |
{% for news_item in news%} | |
<p> | |
<b>{{str(news_item['datetime_added'])}}</b> | |
</p> | |
<p> | |
{{ news_item.get('text', '') }} | |
</p> |
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
class MP3UploadHandler(tornado.web.RequestHandler): | |
def get(self): | |
self.render('mp3upload.html') | |
def post(self): | |
mp3=self.request.files['mp3'][0] #mp3 post data from form | |
mp3body=mp3['body'] #body of mp3 file | |
mp3name = mp3['filename'] #mp3 name and path | |
conn = S3Connection('AWS_ACCESS_KEY_ID','AWS_SECRET_ACCESS_KEY') #amazon s3 connection | |
bucket = conn.create_bucket('foundsound_mp3') #bucket for images |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# vispy: gallery 2 | |
# Copyright (c) 2014, Vispy Development Team. | |
# Distributed under the (new) BSD License. See LICENSE.txt for more info. | |
# | |
# Modified for animation with MoviePy by Zulko | |
# See result here: http://i.imgur.com/sSCBkFd.gif | |
# |
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
import httplib2,random, json | |
odoo_url = 'SERVER_URL' | |
class OdooConnector: | |
context = {} | |
http = False | |
cookies = '' | |
def __init__(self): |
OlderNewer