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
float invSqrt(float x) | |
{ | |
union { | |
float x; | |
int i; | |
} u; | |
float xhalf = 0.5f * x; | |
u.x = x; | |
u.i = 0x5f3759df - (u.i >> 1); |
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
import os | |
def cls(): | |
os.system('cls' if os.name == 'nt' else clear) | |
# moved the first conversion into its own function for easier testing (either manual or automated) | |
def dist2cm(mode, distance): | |
# concert all to cm |
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
import os | |
def cls(): | |
os.system('cls' if os.name == 'nt' else clear) | |
# this is a function that returns a dictionary/key-value-pair 'list' | |
# the reason that this isn't a regular variable, as that they can be changed | |
# and Python doesn't have any constants, so you can use a function that returns |
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
// I found this little nugget 6 times in a 5000+ lines god-class, with the deepest indent being 23 tabs deep. | |
if (var.Length < 3) | |
{ | |
if (var.Length < 2) | |
{ | |
if (var == "") | |
{ | |
var = "000"; | |
} | |
else |