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
//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 { |
#!/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 |
import numpy as np | |
from direct.showbase.ShowBase import ShowBase | |
from panda3d.core import Texture, CardMaker, TextureStage | |
from panda3d.core import WindowProperties, ColorBlendAttrib, TransformState | |
from direct.showbase import ShowBaseGlobal | |
def sin_byte(X, freq = 1): | |
""" | |
Creates unsigned 8 bit representation of sin (T_unsigned_Byte). | |
""" |
import numpy as np | |
from direct.showbase.ShowBase import ShowBase | |
from panda3d.core import Texture, CardMaker, TextureStage | |
from panda3d.core import WindowProperties, ColorBlendAttrib, TransformState | |
from direct.showbase import ShowBaseGlobal | |
def sin_byte(X, freq = 1): | |
""" | |
Creates unsigned 8 bit representation of sin (T_unsigned_Byte). | |
""" |
# fixed using rdb suggestion | |
import sys | |
import numpy as np | |
from direct.showbase.ShowBase import ShowBase | |
from direct.showbase import ShowBaseGlobal #global vars defined by p3d | |
from panda3d.core import Texture, CardMaker, TextureStage, KeyboardButton | |
from panda3d.core import WindowProperties | |
from direct.task import Task |
import sys | |
import numpy as np | |
from direct.showbase.ShowBase import ShowBase | |
from direct.showbase import ShowBaseGlobal #global vars defined by p3d | |
from panda3d.core import Texture, CardMaker, TextureStage, KeyboardButton | |
from panda3d.core import WindowProperties | |
from direct.task import Task | |
import numpy as np | |
from direct.showbase.ShowBase import ShowBase | |
from panda3d.core import Texture, CardMaker, TextureStage | |
from panda3d.core import WindowProperties | |
def rgb_texture(texture_size = 512, rgb = (0, 0, 0)): | |
x = np.linspace(-texture_size/2, texture_size/2, texture_size) | |
y = np.linspace(-texture_size/2, texture_size/2, texture_size) | |
X, Y = np.meshgrid(x, y) |
#!/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 |
""" | |
cube of concentric sinusoids: one shown in matplotlib, then in panda3d statically, then | |
in task manager in sequence when they turn dark. | |
""" | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from direct.showbase.ShowBase import ShowBase | |
from panda3d.core import Texture, CardMaker, TextureStage | |
from direct.task import Task | |
from direct.showbase import ShowBaseGlobal #global vars defined by p3d |