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 | |
error_reporting(E_ALL); | |
ini_set('display_errors', 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
tuple # typing.Tuple | |
list # typing.List | |
dict # typing.Dict | |
set # typing.Set | |
frozenset # typing.FrozenSet | |
type # typing.Type | |
collections.deque | |
collections.defaultdict | |
collections.OrderedDict | |
collections.Counter |
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
function realIntVal($s, $onEmptyStr=null, $onNonNumeric=null) { | |
if ($s === '') return $onEmptyStr; | |
return is_numeric($s) ? intval($s) : $onNonNumeric; | |
} | |
function testRealIntVal() { | |
$arr = ['', '0', '1', 'a', 'a123', '123a', null]; | |
$res = []; | |
foreach ($arr as $v) { | |
$res[$v] = realIntVal($v); |
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
function arrGet($arr, $key, $default = null) | |
{ | |
return isset($arr[$key]) ? $arr[$key] : $default; | |
} | |
function arrAny() | |
{ | |
foreach (func_get_args() as $arg) { | |
if ($arg) return $arg; | |
} |
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 sys | |
import re | |
############################################################################### | |
# from six.py: | |
# Useful for very coarse version differentiation. | |
PY2 = sys.version_info[0] == 2 | |
PY3 = sys.version_info[0] == 3 | |
PY34 = sys.version_info[0:2] >= (3, 4) |
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
#!/usr/bin/env python | |
def fn_none(): | |
""" | |
>>> fn_none() is None | |
True | |
""" | |
return None |
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
.DS_Store | |
Thumbs.db | |
# any | |
.git | |
# joplin | |
.lock | |
# rust |
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
def s_ring(r1, r2): | |
pi = 3.1415 | |
s1 = pi * (r1 ** 2) | |
s2 = pi * (r2 ** 2) | |
s = s2 - s1 | |
return s | |
def hyp(a, b): | |
return (a ** 2 + b ** 2) ** 0.5 |
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 pygame as pg | |
FPS = 30 | |
WW = 800 | |
WH = 600 | |
BLUE = (0, 0, 255) | |
BLACK = (0, 0, 0) | |
WHITE = (255, 255, 255) |
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
pygame | |
#pycairo | |
p5 |
OlderNewer