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
def info(obj, spacing=10, collapse=True): | |
"""Print methods and doc strings. | |
:param obj: object to inspect | |
:type obj: module or class or list or dict or str or unicode | |
:param spacing: left column width | |
:type spacing: int | |
:param collapse: whether to collapse the text when printing | |
:type collapse: bool | |
""" | |
# Modified version of the function from Dive Into Python. |
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
def sha256_file(file_path, chunk_size=65336): | |
""" | |
Get the sha 256 checksum of a file. | |
:param file_path: path to file | |
:type file_path: unicode or str | |
:param chunk_size: number of bytes to read in each iteration. Must be > 0. | |
:type chunk_size: int | |
:return: sha 256 checksum of file | |
:rtype : str | |
""" |
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
function loadView(url, div) { | |
// Will get the result of the appropriate view url then display the data | |
// in the specified `div`, where `div` is a jQuery selector. Usage: | |
// var div = $("#my_target_div"); | |
// var url = "~/Example/View"; | |
// loadView(url, div); | |
$.get(url, function (data) { div.html(data); }, "html"); | |
// Parameter dataType value "html" required on Firefox only, for some reason. | |
// See http://stackoverflow.com/questions/11441020/jquery-ajax-exception-only-in-firefox-node-cannot-be-inserted-at-the-specified | |
} |