.. automodule:: app_name.views :members:
This file contains hidden or 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
var parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |
This file contains hidden or 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
sudo apt-get install openvpn network-manager-openvpn network-manager-openvpn-gnome | |
sudo apt-get install network-manager-vpnc | |
sudo /etc/init.d/networking restart |
This file contains hidden or 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 multiprocessing import Pool, cpu_count | |
def run_parallel_selenium_processes(datalist, selenium_func): | |
pool = Pool() | |
# max number of parallel process | |
ITERATION_COUNT = cpu_count()-1 | |
count_per_iteration = len(datalist) / float(ITERATION_COUNT) |
This file contains hidden or 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
AttributeError: 'Unicode' object has no attribute 'tag' |
This file contains hidden or 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
python -m IPython notebook |
This file contains hidden or 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 wsgiref.simple_server import make_server | |
from cgi import parse_qs, escape | |
def show_get_params(environ, start_response): | |
subject = parse_qs(environ.get('QUERY_STRING', '')) | |
start_response('200 OK', [('Content-Type', 'text/html')]) | |
return ['''%(subject)s''' % {'subject': subject}] | |
srv = make_server('localhost', 3000, show_get_params) | |
srv.serve_forever() |
This file contains hidden or 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
componentWillReceiveProps(newProps){ | |
this.setState({ | |
editorState: createEditorState(newProps.current_content), | |
}) | |
} |
This file contains hidden or 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
def find_match_for_dataframes(df1, df2, cols_to_compare=[], name_of_new_row="found_in_row"): | |
copy_df2 = df2 | |
df1[name_of_new_row] = "" | |
for idx, item in df1.iterrows(): | |
for idx_comp, comp_item in copy_df2.iterrows(): | |
# check if all conditions are successful | |
# returns True if the list is empty |
This file contains hidden or 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 django | |
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings") | |
django.setup() |