Skip to content

Instantly share code, notes, and snippets.

@Maoyeedy
Maoyeedy / DialogPlayer.cs
Last active January 30, 2023 05:32
Unity Dialog Script
using System;
using System.Collections;
using TMPro;
using UnityEngine;
public class DialogPlayer : MonoBehaviour
{
public Dialog[] dialogs;
public TextMeshProUGUI dialogText, nameText;
public float characterInterval = 0.05f, autoNextLineTime = 2.5f;
@Maoyeedy
Maoyeedy / Screenshot.cs
Last active October 14, 2023 08:49
A minimal Unity screenshot script
using System;
using System.IO;
using UnityEngine;
public class ScreenshotScript : MonoBehaviour
{
public string folderPath = Path.Combine(Application.dataPath, "..", "SampleRecordings");
public KeyCode captureKey = KeyCode.Tab;
private void Start()
const img = document.querySelectorAll('img');
img.forEach((image) => {
image.draggable = false;
});
const anchors = document.querySelectorAll('a');
anchors.forEach((anchor) => {
anchor.target = '_blank';
anchor.rel = 'noopener';
anchor.draggable = false;
.gist .blob-code-inner,
.gist .blob-num {
font-family: 'Spline Sans Mono', monospace !important;
font-size: 0.8rem !important;
}
.gist .gist-file {
margin: 0 !important;
border-radius: 1em !important;
}
#!/bin/sh
const imgElements = document.querySelectorAll('.fullscreenable img')
imgElements.forEach(img => {
img.addEventListener('click', () => {
const src = img.getAttribute('src')
const overlay = document.createElement('div')
overlay.style.width = '100%'
overlay.style.height = '100%'
overlay.style.position = 'fixed'
function extendImagesWithPicture () {
let imgElements = document.querySelectorAll("img")
imgElements.forEach(function (img) {
let dataSrc = img.getAttribute("data-src")
let path = dataSrc.substring(0, dataSrc.lastIndexOf("/") + 1)
let imageName = dataSrc.substring(dataSrc.lastIndexOf("/") + 1, dataSrc.lastIndexOf("."))
let picture = document.createElement("picture")
let sourceAVIF = document.createElement("source")
@Maoyeedy
Maoyeedy / Windows Defender Exclusions for Developer.ps1
Last active September 3, 2023 09:39 — forked from nerzhulart/Windows Defender Exclusions for Developer.ps1
Adds Windows Defender exclusions for developers (Visual Studio, JetBrains Rider, IntellIJ Idea, Git, MsBuild, dotnet, mono etc.)
$userPath = $env:USERPROFILE
$pathExclusions = New-Object System.Collections.ArrayList
$processExclusions = New-Object System.Collections.ArrayList
# Custom
$pathExclusions.Add($userPath + '\UnityProjects') > $null
$pathExclusions.Add($userPath + '\UnrealProjects') > $null
$processExclusions.Add('UnrealEngine.exe') > $null
$processExclusions.Add('blender.exe') > $null
$processExclusions.Add('maya.exe') > $null
@Maoyeedy
Maoyeedy / Set-UnityAssetStoreProtocolHandler.ps1
Last active October 15, 2023 17:21
Solution to Unity Asset Store "Open in Unity" button not working on Windows
$EditorRootPath = "C:\Program Files\Unity\Hub\Editor"
$versions = Get-ChildItem -Directory $EditorRootPath | Select-Object -Expand Name
$latestVersion = ($versions | Sort-Object -Descending | Select-Object -First 1)
$unityExe = Join-Path $EditorRootPath "$latestVersion\Editor\Unity.exe"
Write-Host "Try registering URL:com.unity3d.kharma for $unityExe"
Remove-Item -Path "Registry::HKEY_CLASSES_ROOT\UnityAssetStore" -Recurse -ErrorAction SilentlyContinue
New-Item -Path "Registry::HKEY_CLASSES_ROOT\UnityAssetStore" | Out-Null
New-Item -Path "Registry::HKEY_CLASSES_ROOT\UnityAssetStore\DefaultIcon" | Out-Null
@Maoyeedy
Maoyeedy / UnityDocsHighlight.user.js
Last active December 6, 2023 20:08
[Userscript] Unity Document Syntax Highlight
// ==UserScript==
// @name Unity Docs Syntax Hightligher Fork
// @namespace https://github.com/Maoyeedy
// @version 1.2.7
// @author Maoyeedy
// @license MIT
// @description Adds syntax highlighting to the Unity Documentation. Forked from hyblocker.
// @icon https://unity.com/favicon.ico
//
// @match https://docs.unity3d.com/Manual/*
@Maoyeedy
Maoyeedy / .editorconfig
Last active October 24, 2023 15:59
.editorconfig from Rider 2023.2.2
[*]
charset = utf-8-bom
end_of_line = crlf
indent_size = 4
indent_style = space
insert_final_newline = false
max_line_length = 120
tab_width = 4
trim_trailing_whitespace = false
ij_continuation_indent_size = 8