Skip to content

Instantly share code, notes, and snippets.

View JEuler's full-sized avatar
:shipit:

Ivan Terekhin JEuler

:shipit:
View GitHub Profile
@JEuler
JEuler / generate-favicon.js
Created December 20, 2024 02:16
Generate Favicons Node JS script
import sharp from 'sharp';
import path from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const sizes = [16, 32, 48, 64, 128, 256];
const inputFile = path.join(__dirname, '../public/logo.png');
const outputDir = path.join(__dirname, '../public');
@JEuler
JEuler / insert_ltr.py
Created November 29, 2024 05:50
Insert android:layoutDirection="ltr" to all xml in directory
import os
from lxml import etree
# List of tags to add android:layoutDirection="ltr"
ALLOWED_LAYOUT_TAGS = {"RelativeLayout", "LinearLayout", "FrameLayout", "ConstraintLayout"}
def process_xml_file(file_path):
try:
tree = etree.parse(file_path)
root = tree.getroot()
@JEuler
JEuler / gist:0ea3af22b95bd191c56780d1f67bc362
Created August 24, 2024 07:16
Git commit message prompt for Cursor
@Commit (Diff of Working State) Please generate a commit message that:",
“1. Summarizes the main purpose of the changes”,
“2. Follows best practices for commit message formatting”,
“3. Includes any relevant details about the implementation or impact”,
“4. Mentions any new files added or significant refactoring”,
“\nSuggested commit message format:”,
“<type>(<scope>): <subject>”,
“”,
“<body>”,
“”,
@JEuler
JEuler / Android Icons.jsx
Created May 5, 2024 07:01 — forked from pescode/Android Icons.jsx
Unity Icons Generator for Win Store, Android & iOS Photoshop Script
// Based on https://gist.github.com/appsbynight/3681050 by Matt Di Pasquale
// Author: Victor Corvalan
// http://twitter.com/pescadon
// This script will generate squares and wide Icons & Tiles required for Windows Store build on Unity3D
// Prepare 1 big icon of 512x512px
// Open this script with Photoshop -> File -> Scripts -> Browse
// Load your icon when prompted
var destFolder;
try
@JEuler
JEuler / extract.py
Created March 4, 2024 13:49
Extract .jpg files from folders in some current folder.
import os
import shutil
def extract_jpg_files(root_folder):
for root, dirs, files in os.walk(root_folder):
for file in files:
if file.endswith('.jpg'):
source_path = os.path.join(root, file)
destination_path = os.path.join(root_folder, file)
shutil.move(source_path, destination_path)
@JEuler
JEuler / screenshot.gd
Created August 15, 2023 09:34 — forked from jotson/screenshot.gd
Godot GDScript screenshot function
# This is a function for capturing screenshots with GDScript
func screenshot():
# Capture the screenshot
var size = OS.window_size
var image = get_viewport().get_texture().get_data()
# Setup path and screenshot filename
var date = OS.get_datetime()
var path = "user://screenshots"
var file_name = "screenshot-%d-%02d-%02dT%02d:%02d:%02d" % [date.year, date.month, date.day, date.hour, date.minute, date.second]
@JEuler
JEuler / Screenshooter.cs
Created July 22, 2023 10:50
Unity Screenshooter
public class ScreenShooter : MonoBehaviour {
private int _count = 0;
// Update is called once per frame
private void Update() {
if ( Input.GetKeyDown( KeyCode.S ) ) {
while ( System.IO.File.Exists( "ScreenShot_" + _count + "_" + Screen.width + "x" + Screen.height + ".png" ) ) {
_count++;
}
ScreenCapture.CaptureScreenshot( "ScreenShot_" + _count + "_" + Screen.width + "x" + Screen.height + ".png" );
}
void main() {
final configuredApp = AppConfig(
appName: 'App',
flavorName: 'uat',
apiBaseUrl: uatServerUrl,
coreAppBaseUrl: uatServerCoreUrl,
child: App(
WebService.create(uatServerUrl),
StorageServiceImpl(),
CoreAppWebService.create(uatServerCoreUrl),
class AppConfig extends InheritedWidget {
const AppConfig({
Key? key,
required this.appName,
required this.flavorName,
required this.apiBaseUrl,
required this.coreAppBaseUrl,
required Widget child,
}) : super(child: child);
class StringHelper {
static String removeAllHtmlTags(String htmlText) {
final RegExp exp = RegExp("<[^>]*>", multiLine: true);
return htmlText.replaceAll(exp, '');
}
static String shrinkSecondName(String? name) {
if (name != null && name.isNotEmpty) {
final nameStr = name.split(' ');