Skip to content

Instantly share code, notes, and snippets.

View tupy's full-sized avatar

Osvaldo Matos-Junior tupy

View GitHub Profile
@tupy
tupy / client_render.js
Created January 20, 2013 02:32
Render time in a browser
//http://stackoverflow.com/questions/2516665/how-can-i-monitor-the-rendering-time-in-a-browser
var renderStart = new Date().getTime();
window.onload=function() {
var elapsed = new Date().getTime()-renderStart;
// send the info to the server
alert('Rendered in ' + elapsed + 'ms');
}
import flask
import gevent
app = flask.Flask(__name__)
def task():
print flask.render_template_string('Hello World!')
def with_context():
with flask.current_app.test_request_context():
@tupy
tupy / sample.py
Created November 19, 2012 13:12
HTMLTags - generate HTML in Python (Python recipe)
print A('bar', href="foo") ==> <A href="foo">bar</A>
@tupy
tupy / gist:3693808
Created September 10, 2012 20:58 — forked from dlutzy/gist:2469037
Multi VM Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# David Lutz's Multi VM Vagrantfile
# inspired from Mark Barger's https://gist.github.com/2404910
boxes = [
{ :name => :web, :role => 'web_dev', :ip => '192.168.33.1', :ssh_port => 2201, :http_fwd => 9980, :cpus =>4, :shares => true },
{ :name => :data, :role => 'data_dev', :ip => '192.168.33.2', :ssh_port => 2202, :mysql_fwd => 9936, :cpus =>4 },
{ :name => :railsapp, :role => 'railsapp_dev', :ip => '192.168.33.3', :ssh_port => 2203, :http_fwd => 9990, :cpus =>1}
]
@tupy
tupy / base.html
Last active August 29, 2015 13:59
Minicurso Python na Copa - Python Day Feira de Santana
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="{{url_for('static', filename='css/bolao.css')}}" rel="stylesheet" />
{% block css %}{% endblock %}
{% block js %}{% endblock %}
</head>