This file contains hidden or 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 kivy.utils import platform | |
def is_desktop(): | |
""" | |
Detect if we are running on the desktop or not | |
:return: boolean True if running on a desktop platform or String platform | |
""" | |
if platform in ('linux', 'win', 'macosx'): | |
return True | |
else: |
This file contains hidden or 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 kivy.core.text import LabelBase | |
KIVY_FONTS = [ | |
{ | |
"name": "Ubuntu", | |
"fn_regular": "assets/fonts/ubuntu/Ubuntu-L.ttf", | |
"fn_bold": "assets/fonts/ubuntu/Ubuntu-M.ttf", | |
"fn_italic": "assets/fonts/ubuntu/Ubuntu-LI.ttf", | |
"fn_bolditalic": "assets/fonts/ubuntu/Ubuntu-MI.ttf" | |
} | |
] |
This file contains hidden or 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 orientation(self, width, height): | |
""" | |
Determine an image orientation based on width and height | |
:param w: width | |
:param h: height | |
:return: boolean (landscape, portrait, square) | |
""" | |
square = False | |
landscape = False | |
portrait = False |
This file contains hidden or 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
class MyImage(Image): | |
def __init__(self, **kwargs): | |
super(MyImage, self).__init__() | |
def texture_width(self): | |
return self.texture.size[0] | |
def texture_height(self): | |
return self.texture.size[1] |
This file contains hidden or 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
#!/bin/bash | |
# Function to display usage information | |
usage() { | |
echo "Usage: $0 [-d | --directory] <directory>" | |
echo " -d, --directory Specify the directory to search (default: current directory)" | |
exit 1 | |
} | |
# Default directory is the current directory |
This file contains hidden or 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 | |
/** | |
* Validate and adjust year and month parameters, calculate date range for a complete whole month, | |
* and add MySQL date and Unix timestamp values to the params. | |
* | |
* Default to current year and month if there's a problem. | |
* | |
* @param array $params - requires 'year' and 'month' as int or will default to current values | |
* @return array | |
*/ |
This file contains hidden or 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
#!/bin/sh | |
# path settings | |
MYSQL=`which mysql` | |
# mysql settings | |
DB="MYDB" | |
HOST="127.0.0.1" | |
USER="root" | |
PASS="root" |
This file contains hidden or 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 | |
/** | |
* Get memory usage in megabytes. | |
* | |
* @return string Memory usage in the format "used/peak" where both values are in MB. | |
*/ | |
function get_memory_used(): string { | |
$memoryUsage = memory_get_usage() / 1024 / 1024; | |
$peakMemoryUsage = memory_get_peak_usage() / 1024 / 1024; |
This file contains hidden or 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
#!/bin/sh | |
MYSQLDUMP=`which mysqldump` | |
DB="mysql" | |
HOST="127.0.0.1" | |
USER="root" | |
PASS="root" | |
# backup file settings |
This file contains hidden or 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
#!/bin/sh | |
MYSQLDUMP=`which mysqldump` | |
# mysql settings | |
DB="mysql" | |
HOST="127.0.0.1" | |
USER="root" | |
PASS="root" |
OlderNewer