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
# Modified to add cryptography from the spreadsheet example: | |
# https://developers.google.com/sheets/api/quickstart/python | |
# https://github.com/gsuitedevs/python-samples/blob/master/sheets/quickstart/quickstart.py | |
# | |
# Copyright 2018 Google LLC | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# |
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
"""Extract metadata from Project Gutenberg RDF catalog into a Python dict. | |
Based on https://bitbucket.org/c-w/gutenberg/ | |
>>> md = readmetadata() | |
>>> md[123] | |
{'LCC': {'PS'}, | |
'author': u'Burroughs, Edgar Rice', | |
'authoryearofbirth': 1875, | |
'authoryearofdeath': 1950, |
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
# This file is to sum up how to get the hardware architecture (32 or 64 bits) | |
# solutions are taken from here: | |
# https://stackoverflow.com/questions/1405913/how-do-i-determine-if-my-python-shell-is-executing-in-32bit-or-64bit-mode-on-os | |
# https://stackoverflow.com/questions/1842544/how-do-i-detect-if-python-is-running-as-a-64-bit-application | |
def get_platform(): | |
""" | |
Finds if the platform is 32 or 64 bits | |
Several different ways are tried in case one fails |
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
mainApp.directive('vextab', function($compile){ | |
return{ | |
//note, WARNING with E (Element) it breaks the placement of the player | |
restrict: 'EC', | |
//restrict: 'C', | |
link: function(scope, element, attrs){ | |
try { | |
new Vex.Flow.TabDiv(element); | |
} |
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
mainApp.directive('vexchord', function($compile){ | |
//console.log("rendering vextab"); | |
return{ | |
restrict: 'E', | |
link: function(scope, element, attrs){ | |
var el = createChordElement(createChordStruct(attrs.key, attrs.string, attrs.shape)); | |
$compile(el)(scope); | |
element.replaceWith(el); | |
//console.log("finish vexchord processing"); | |
} |
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
mainApp.directive('vextab', function($compile){ | |
//console.log("rendering vextab"); | |
var canvas = document.createElement('canvas'); | |
renderer = new Vex.Flow.Renderer( canvas, | |
//Vex.Flow.Renderer.Backends.SVG); | |
Vex.Flow.Renderer.Backends.CANVAS); | |
artist = new Vex.Flow.Artist(10, 10, 800, {scale: 0.8}); | |
vextab = new Vex.Flow.VexTab(artist); | |
return{ |
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
mainApp.directive('markdown', function (){ | |
//console.log("evaluating markdown"); | |
var converter = new Showdown.converter(); | |
return { | |
restrict: 'AEC', | |
link: function (scope, element, attrs) { | |
//console.log("evaluating markdown 2"); | |
var htmlText = converter.makeHtml(element.text() || ''); | |
element.html(htmlText); | |
} |
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 get_code_message(num): | |
""" | |
gets an or simple string and returns a descriptive message of the status | |
""" | |
translate_codes = { | |
100: "100 Continue", | |
101: "101 Switching Protocols", | |
200: "200 OK", | |
201: "201 Created", | |
202: "202 Accepted", |