Skip to content

Instantly share code, notes, and snippets.

View dahnielson's full-sized avatar

Anders Dahnielson dahnielson

View GitHub Profile
@dahnielson
dahnielson / exceptions.md
Created July 29, 2010 11:55
Standard exceptions

Exceptions

  • std::exception
    • std::bad_alloc thrown by new on allocation failure.
    • std::bad_cast thrown by dynamic_cast when fails with a referenced type.
    • std::bad_exception thrown when an exception type doesn't match any catch.
    • std::bad_typeid thrown by typeid.
    • std::logic_error thrown by logic errors, represent problems in the internal logic of a program; in theory, these are preventable, and even detectable
@dahnielson
dahnielson / gist:469501
Created July 9, 2010 14:15
Time accumulator
import pygame
class Time(object):
def __init__(self, uiTimeStep):
"Takes the time step in milliseconds as argument."
self.uiTimeStep = uiTimeStep
self.uiNewTime = 0
self.uiCurrentTime = 0
self.uiTimeAccumulator = 0
@dahnielson
dahnielson / dirate.py
Created July 7, 2010 09:12
Transfer rate/storage capacity calculator
# Load in IPython and use as transfer rate
# and storage capacity calculator.
bytes = 8
bits = 24
width = 1280
height = 720
fps = 24