Skip to content

Instantly share code, notes, and snippets.

View mopsicus's full-sized avatar
🎯
Focusing

Igor mopsicus

🎯
Focusing
View GitHub Profile
@mopsicus
mopsicus / turbo_aegea.php
Last active July 7, 2021 23:30
Generate RSS channel file Yandex turbo for Aegea blogengine
<?
$db_user = ''; // db user name
$db_password = ''; // db pass
$db_database = ''; // db name
$db_host = 'localhost'; // db url
$db = new mysqli($db_host, $db_user, $db_password, $db_database);
$result = $db->query("SELECT * FROM `notes` WHERE IsPublished = 1 AND isvisible = 1 ORDER BY `Stamp` DESC LIMIT 1");
@mopsicus
mopsicus / SnapPosition.cs
Created January 16, 2020 09:21
Snap position for screen edges with offset
using UnityEngine;
/// <summary>
/// Fix position for objects in non canvas
/// </summary>
[ExecuteInEditMode]
public class SnapPosition : MonoBehaviour {
/// <summary>
/// Anchor settings
@mopsicus
mopsicus / DefaultStencil.shader
Last active January 28, 2020 07:03
DefaultStencil.shader (old shader for old Unity version)
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
Shader "Sprites/DefaultStencil"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
[MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
@mopsicus
mopsicus / installtools.sh
Created February 26, 2020 09:07
Bash script for uninstalling and installing apk on multiple connected devices at once
#!/bin/bash
clear
START=$(date +"%s")
function ShowElapsedTime {
echo ''
end=$(date +"%s")
elapsed=$(($end-$START))
@mopsicus
mopsicus / TextGradient.cs
Last active April 8, 2023 20:49
Apply gradient to whole TMP text, but no for each character
// ----------------------------------------------------------------------------
// The MIT License
// TextGradient https://gist.github.com/mopsicus/9d344451ca614d7e9937bc0c6da2b21d
// Copyright (c) 2020 Mopsicus <mail@mopsicus.ru>
// ----------------------------------------------------------------------------
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
@mopsicus
mopsicus / PreBuildManifestUpdate.cs
Created September 27, 2021 07:11
Update AndroidManifest.xml before build to set hardwareAccelerated to true
using System.IO;
using System.Text;
using System.Xml;
using UnityEditor.Android;
public class PreBuildManifestUpdate : IPostGenerateGradleAndroidProject {
/// <summary>
/// Method runs after gradle generated, before build
/// </summary>
@mopsicus
mopsicus / EmojiHelper.cs
Last active January 31, 2022 15:06
Helper for TextMeshPro to find and parse emoji
// ----------------------------------------------------------------------------
// The MIT License
// EmojiHelper https://gist.github.com/mopsicus/3903a1f111a738375a363b9e3f058385
// Copyright (c) 2022 Mopsicus <mail@mopsicus.ru>
// ----------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;