UPDATE 2014-12-21: RubyGems 1.8.30, 2.0.15 and 2.2.3 have been released. It requires manual installation, please see instructions below.
Hello,
If you reached this page, means you've hit this SSL error when trying to
Simple Ruby Server: | |
# ruby -run -e httpd -- -p 5000 . | |
Simple Python 2 Server: | |
# python -m SimpleHTTPServer | |
Simple Python 3 Server: | |
# python -m http.server |
from UserDict import IterableUserDict | |
import collections | |
__author__ = 'github.com/hangtwenty' | |
def tupperware(mapping): | |
""" Convert mappings to 'tupperwares' recursively. |
UPDATE 2014-12-21: RubyGems 1.8.30, 2.0.15 and 2.2.3 have been released. It requires manual installation, please see instructions below.
Hello,
If you reached this page, means you've hit this SSL error when trying to
#!/usr/bin/python | |
import sys #for cmd line argv | |
#take command line args as the input string | |
input_string = sys.argv | |
#remove the program name from the argv list | |
input_string.pop(0) | |
#convert to google friendly url (with + replacing spaces) |
import threading | |
import time | |
class ThreadingExample(object): | |
""" Threading example class | |
The run() method will be started and it will run in the background | |
until the application exits. | |
""" |
import re | |
from jinja2 import evalcontextfilter, Markup, escape | |
@app.template_filter() | |
@evalcontextfilter | |
def linebreaks(eval_ctx, value): | |
"""Converts newlines into <p> and <br />s.""" | |
value = re.sub(r'\r\n|\r|\n', '\n', value) # normalize newlines | |
paras = re.split('\n{2,}', value) |
/* Brazilian initialisation for the jQuery UI date picker plugin. */ | |
/* Written by Leonildo Costa Silva ([email protected]). */ | |
jQuery(function($){ | |
$.datepicker.regional['pt-BR'] = { | |
closeText: 'Fechar', | |
prevText: '<Anterior', | |
nextText: 'Próximo>', | |
currentText: 'Hoje', | |
monthNames: ['Janeiro','Fevereiro','Março','Abril','Maio','Junho', | |
'Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'], |
from flask import Flask, request, redirect, url_for, make_response, abort | |
from werkzeug import secure_filename | |
from pymongo import MongoClient | |
from bson.objectid import ObjectId | |
from gridfs import GridFS | |
from gridfs.errors import NoFile | |
ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif']) |
from flask import Flask, request, redirect, url_for, make_response, abort | |
from mongoengine.fields import get_db | |
from bson import ObjectId | |
from gridfs import GridFS | |
from gridfs.errors import NoFile | |
from <your_app> import app | |
@app.route('/files/<oid>') | |
def serve_gridfs_file(oid): | |
try: |
#!/usr/bin/env python | |
# Multi-threading template | |
import argparse, subprocess, signal, Queue | |
from threading import Thread, Lock | |
from sys import stdout | |
from os import getpid, kill | |
class myThread (Thread): | |
def __init__(self, threadID, name, q): |