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
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) |
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. | |
""" |
#!/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) |
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
from UserDict import IterableUserDict | |
import collections | |
__author__ = 'github.com/hangtwenty' | |
def tupperware(mapping): | |
""" Convert mappings to 'tupperwares' recursively. |
Simple Ruby Server: | |
# ruby -run -e httpd -- -p 5000 . | |
Simple Python 2 Server: | |
# python -m SimpleHTTPServer | |
Simple Python 3 Server: | |
# python -m http.server |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
# ** Cakefile Template ** is a Template for a common Cakefile that you may use in a coffeescript nodejs project. | |
# | |
# It comes baked in with 5 tasks: | |
# | |
# * build - compiles your src directory to your lib directory | |
# * watch - watches any changes in your src directory and automatically compiles to the lib directory | |
# * test - runs mocha test framework, you can edit this task to use your favorite test framework | |
# * docs - generates annotated documentation using docco | |
# * clean - clean generated .js files | |
files = [ |
from selenium import webdriver | |
driver = webdriver.Firefox() | |
driver.get('https://www.facebook.com/') | |
with open('jquery-1.9.1.min.js', 'r') as jquery_js: | |
jquery = jquery_js.read() #read the jquery from a file | |
driver.execute_script(jquery) #active the jquery lib | |
driver.execute_script("$('#email').text('anhld')") |
/* | |
* str2bool | |
* args: strvalue (um valor boleano valido como string: "true"/"false"/"0"/"1") | |
* return bool | |
*/ | |
function str2bool(strvalue){ | |
return (strvalue && typeof strvalue == 'string') ? (strvalue.toLowerCase() == 'true' || strvalue == '1') : (strvalue == true); | |
} |