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
In [1]: b = object() | |
In [2]: import json | |
In [3]: json.dumps(b) | |
--------------------------------------------------------------------------- | |
TypeError Traceback (most recent call last) | |
<ipython-input-3-8c425ddada75> in <module>() | |
----> 1 json.dumps(b) |
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
ELO_DEFAULT = 1500 | |
ELO_K_FACTOR = 16 | |
def expected(Ra, Rb): | |
# https://en.wikipedia.org/wiki/Elo_rating_system | |
Ea = (1.0 / (1.0 + pow(10.0, (Rb-Ra)/400.0))) | |
return Ea, 1-Ea | |
@bot.add_command('!challenge') | |
@gen.coroutine |
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
<?php | |
define('POSITIVE', 1); | |
define('NEGATIVE', -1); | |
define('DB_CONFIG_FILE', '/path/to/mysql.json'); | |
/* MySQLi module does not have this function by default */ | |
function mysqli_field_name($result, $field_offset) { | |
$properties = mysqli_fetch_field_direct($result, $field_offset); | |
return is_object($properties) ? $properties->name : null; | |
} |
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
from logging import Handler | |
import logging | |
""" | |
Usage: | |
@log_handler.on_error() | |
def main_function(): | |
log.debug("You won't see this until later") | |
log.info("You'll see this immediately") |
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
red_1 | red_2 | red_3 | red_4 | red_5 | red_6 | red_7 | red_8 | blue_1 | blue_2 | blue_3 | blue_4 | blue_5 | blue_6 | blue_7 | blue_8 | ||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
X | 8.06 | 19.7 | 25.2 | -19.5 | -13.3 | -2.2 | 25.3 | 0 | -78.2 | -2.2 | -54.9 | 8.3 | 33.9 | -42.8 | -39.0 | 0 | |
Y | 1465.7 | 1505.5 | 1462.2 | 1476.8 | 1435.9 | 1402.9 | 1361.6 | 0 | 1500.1 | 1483.2 | 1446.9 | 1423.3 | 1.33.5 | 1372.6 | 1433.6 | 0 | |
Thrown | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | |
In Play | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 |
OlderNewer