A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
| #!/usr/bin/env python3 | |
| # -*- coding: utf-8 -*- | |
| """ | |
| Some simple examples of the public endpoints available for examining users, | |
| characters, and clans using the Destiny API. | |
| You will need to put in your own api key to run it. To learn how go to: | |
| http://destinydevs.github.io/BungieNetPlatform/docs/API-Key | |
| """ | |
| import requests |
| RAID STATS : { | |
| "allTime": { | |
| "activitiesCleared": { | |
| "statId": "activitiesCleared", | |
| "basic": { | |
| "value": 3.0, | |
| "displayValue": "3" | |
| } | |
| }, | |
| "activitiesEntered": { |
| #!/usr/bin/env python3 | |
| # -*- coding: utf-8 -*- | |
| """ | |
| Getting Started using the Destiny 2 Api | |
| An annotated guide to some of the public endpoints available for examining a user's | |
| characters, items, and clan using the Destiny 2 API. You will need to use your api key for | |
| this to work. Just insert it as a string where it says <my_api_key> in the beginning. | |
| It is broken into four parts: | |
| 0: Imports, variables, and fixed parameters defined |
| class Endpoint: | |
| """ | |
| Abstract end point class: this is never used directly. Concrete | |
| endpoints inherit from this. | |
| """ | |
| def __init__(self, headers, request_parameters = None, url_arguments = None): | |
| self.url_arguments = url_arguments | |
| self.url_initial = self.make_url() | |
| self.request_params = request_parameters | |
| self.headers = headers |
| //Working version of calculator from Chapter 6 of stroustrup | |
| //Contains way too many print statements so you can track what is going on. | |
| //Each grammatical rule, and main, is annotated with attempt to explain what is happening. | |
| //Note I prefer to use '#' instead of '8' to represent numbers because I'm not a monster (see: Stroop effect). | |
| #include "std_lib_facilities.h" | |
| //------------------------------------------------------------------------------ | |
| class Token { |
| """ | |
| panda3d learning | |
| Exploring default scene graphs rooted with render, render2d, pixel2d | |
| """ | |
| from direct.showbase.ShowBase import ShowBase | |
| from panda3d.core import Texture, CardMaker, NodePath #, PTAUchar, | |
| import numpy as np | |
| #Create random numpy array | |
| size = 1024 |
| """ | |
| Want the sine texture to be a little square inside the card, with noise texture filling the card. | |
| """ | |
| from direct.showbase.ShowBase import ShowBase | |
| from panda3d.core import Texture, CardMaker, TextureStage | |
| from direct.gui.OnscreenText import OnscreenText | |
| import numpy as np | |
| #Create matrices for textures | |
| #sin |
| """ | |
| Trying to get repeated texture | |
| """ | |
| from direct.showbase.ShowBase import ShowBase | |
| from panda3d.core import Texture, CardMaker | |
| import numpy as np | |
| #Create texture | |
| texSize = 64 | |
| texture = 210*np.ones((texSize, texSize), dtype = np.uint8) |
| from direct.showbase.ShowBase import ShowBase | |
| from panda3d.core import Texture, CardMaker, TransparencyAttrib | |
| import numpy as np | |
| #Create texture | |
| texSize = 512 | |
| frequency = 8 | |
| def sin3d(X, freq = 1): | |
| return np.sin(X*freq) | |
| def sin8bit(X, freq = 1): |