Skip to content

Instantly share code, notes, and snippets.

@dogfuntom
dogfuntom / PDFs-to-1st-page-pictures.ps1
Last active January 22, 2024 20:41
PowerShell script that uses Ghostscript to extract 1st page pictures from each PDF in a directory and its subdirectories
# Recursively for each PDF file make a 1st page JPEG nearby.
# Execute `$WhatIfPreference = 1` before running this script to dry run.
# (tip: dry run doesn't require Ghostscript at all, so in this way it's possible to simulate this script is before even actually installing the gs)
# Execute `$VerbosePreference = 'Continue'` before running this script to enable verbose output.
# Execute `$VerbosePreference = 'Inquire'` before running this script to be asked to confirm before each operation.
# (NOTE: the `$VerbosePreference = 'Inquire'` treats `[A] Yes to All` as simply `[Y] Yes` for some reason.)
# (Also any of the above can be copy-pasted right into this script itself but it's rather anti-idiomatic.)
# Where the PDFs are (reminder: this script is recursive but this can be changed easily, see below).
@dogfuntom
dogfuntom / IoC.md
Last active May 21, 2024 21:29
Dependency Injection libraries for Unity game engine in 2022

IoC containers for Unity game engine

Deprecated libraries

Be careful, multiple famous IoC containers are deprecated. At a first glance, it may seem fine to forgive lack of recent commits. After all, if it's mature, then all the basics are done and polished and bugless. In other words, if it the project would be active, then all the new commits would be just exlusively about advanced features. Right? No. The world of game development doesn't work like that. It must innovate rapidly and fretting about backward compatibility is not compatible with this reality.

@dogfuntom
dogfuntom / programmer_fonts.md
Last active January 23, 2024 11:54
Programmer fonts, sorted by how well they're explained
  1. JetBrains Mono — Features, advantages, comparisons, gifs, the size of x-height is explained, it has everything.
  2. FiraCode
  3. Go — Explanation is almost text-only (no gif, almost no pics) but at least it exists.
  4. Input — The information on readability specifically is somewhat low on specific details and is intermixed with a extensive explanation of overall philosophy and other considerations. But at least it's there.
  5. Hack — The prioritized range of sizes is made very clear. Also the 3 most noticable/impactful decisions are included (in the same sentence). Otherwise, nothing is explained.
  6. Victor Mono — Only the overall idea is explained, not particular small decisions.
  7. The Julia — Many examples and screenshots, not much explanation.
  8. [Iosevka
@dogfuntom
dogfuntom / AccessViaDteProperties.cs
Last active January 26, 2020 19:00
VSIX options (settings) cookbook #vsix
// See _common.md to learn what strings PageCategory, PageName and PropertyName are supposed to contain.
const string PageCategory = "Foo";
const string PageName = "Bar";
const string PropertyName = "Baz";
var dte = (DTE2)Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(DTE));
var props = dte.Properties[PageCategory, PageName];
// Read:
// Note that this can throw an exception if such property wasn't saved yet.
@dogfuntom
dogfuntom / PharoSettingsLikeVS.md
Last active April 3, 2017 20:43
Pharo setting for people who love Visual Studio #Pharo #VS #noncode

Case insensitive suggestions

Settings Browser → Code Browsing → Code Completion → Case Sensitive

Dark theme

(Use it only if you prefer dark themes, of course.)

  1. Settings Browser → Appearence → User Interface theme → Dark
  2. Settings Browser → Code Browsing → Syntax Highlighting → Dark
  3. Reopen your windows, because settings above won't be fully applied to already opened windows.
@dogfuntom
dogfuntom / Vim Ideas.md
Last active January 10, 2024 14:40
cheat sheet about registers and marks in vim emulators #vs #vim #vsvim #vsc

Finding opportunities to apply advanced Vim

When it comes to Vim emulators, how to do an advanced operation is not the hard part. The hard part is remembering/recognizing that some routine operation can be helped by Vim.

Log method call

Useful for understanding sloppily/poorly written legacy code. Given a bunch of methods like this:

private void ConfusinglyNamedAndConfusinglyUsedMethod()

@dogfuntom
dogfuntom / BoundsInt.cs
Last active January 31, 2023 09:59
Cast ray in voxel space (i.e. 3d-grid) #Unity
namespace UnityEngine
{
using System;
using System.Runtime.InteropServices;
using UnityEngine.Assertions.Must;
[StructLayout(LayoutKind.Auto)]
internal struct BoundsInt
{
private Vector3i _min;
@dogfuntom
dogfuntom / ContextMenuItems.cs
Last active April 20, 2017 00:43
[uGUI Button context menu] Helps to avoid typing the same thing twice when using uGUI Buttons #Unity #Unity3d #uGUI
using UnityEditor;
using UnityEngine;
using UnityEngine.UI;
internal static class ContextMenuItems
{
[MenuItem("CONTEXT/Button/Copy name to Text")]
private static void CopyNameToText(MenuCommand menuCommand)
{
CopyImpl(menuCommand, true);
@dogfuntom
dogfuntom / Extensions.cs
Last active February 6, 2022 12:30
NOTE that this gist is old (2015). Some stuff is obsolete. Some code I don't find wise to use anymore.
using System;
using System.Collections.Generic;
#if UNITY_EDITOR
using System.Reflection;
using System.Linq;
#endif
public static class Extensions
{
#region float
@dogfuntom
dogfuntom / CodeGenerator_Window.cs
Last active September 7, 2023 17:10
[Unity CodeDom] Editor-time code generator. Generates constant-declaration-only classes for Tags, Layers, Sorting layers and Input axes. Good for type-safety. #Unity #Unity3d #CodeDom
using Microsoft.CSharp;
using System.CodeDom;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;