Skip to content

Instantly share code, notes, and snippets.

View Shilo's full-sized avatar

Shilo Shilo

View GitHub Profile
@AnidemDex
AnidemDex / EditorTricks.md
Last active February 26, 2024 09:22
Some editor tricks that I’ve compiled from time to time

Editor Tricks

Drag and drop data

Editor tell other nodes what data is going to be passed throug some structs that are are converted to dictionaries.

These structs usually have this format:

{type, value, origin}
@kumaran-IV0IV
kumaran-IV0IV / Open with Android Studio.cmd
Last active October 15, 2024 21:38
Add `Open with Android Studio` to Windows right click context menu
@echo off
:: change the path below to match your installed version
SET AndroidStudioPath=C:\Program Files\Android\Android Studio\bin\studio64.exe
echo Adding file entries
@reg add "HKEY_CLASSES_ROOT\*\shell\AndroidStudio" /t REG_SZ /v "" /d "Open with AndroidStudio" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\AndroidStudio" /t REG_EXPAND_SZ /v "Icon" /d "%AndroidStudioPath%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\AndroidStudio\command" /t REG_SZ /v "" /d "%AndroidStudioPath% \"%%1\"" /f
@mxalbert1996
mxalbert1996 / Scrollbar.kt
Last active October 28, 2024 09:30
Modifiers to draw scrollbars in Jetpack Compose
/*
* MIT License
*
* Copyright (c) 2022 Albert Chang
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@AvdLee
AvdLee / DarwinNotificationCenter.swift
Last active November 1, 2024 11:56
A notification center for Darwin Notifications. MIT License applies.
//
// DarwinNotificationCenter.swift
//
// Copyright © 2017 WeTransfer. All rights reserved.
//
import Foundation
/// A Darwin notification payload. It does not contain any userInfo, a Darwin notification is purely event handling.
public struct DarwinNotification {
@regakakobigman
regakakobigman / get_node_property.gd
Last active March 29, 2024 01:31
Gets the property of a node using a NodePath
# This is an awful solution, but NodePath is missing an important method, so there's no great alternative that I've found.
# Try me with get_node_property(self, "Control/Spatial/CollisionShape2D:shape:extents:x")
func get_node_property(from: Node, path: NodePath):
assert ":" in path as String # Causes a hard crash
path = path as NodePath
var node_path = get_as_node_path(path)
var property_path = (path.get_concatenated_subnames() as NodePath).get_as_property_path()
return from.get_node(node_path).get_indexed(property_path)
@BoQsc
BoQsc / Gists.md
Last active October 10, 2024 17:29
How to search my own Gists
@Shilo
Shilo / export_aseprite_layers.bat
Created April 27, 2019 09:50
Batch script to automatically save Aseprite file into layer images for easy import into external animation applications such as Spine and Spriter Pro. (Batch script has to be in same directory and same filename as Aseprite file)
@echo off
@set ASEPRITE="C:\Program Files (x86)\Steam\steamapps\common\Aseprite\Aseprite.exe"
@set FILENAME="%~n0"
if exist %FILENAME% (
choice /c YN /m "Would you like to delete and recreate '%FILENAME%' directory "
if errorlevel == 2 goto save
if errorlevel == 1 goto delete
goto end
)
@johncip
johncip / phaser-2-to-3.md
Last active March 10, 2024 08:16
Moving from Phaser 2 to 3

Moving from Phaser 2 → 3: an incomplete guide

Summary

  • I found that the best thing was to ask myself what this or that line was meant to accomplish, and then to search labs.phaser.io for a Phaser 3 example of that task.
  • Usually the issue is just that a function has moved, or some property now requires a setter.
  • There's a real migration guide here: part 1, part 2

Scenes have replaced states (and the game object… mostly)

@Shilo
Shilo / aspect_fit_bounds_in_bounds.js
Last active August 21, 2018 04:44
Javascript snippet to aspect fit bounds in bounds.
aspectFitBoundsInBounds(src, dest, center=true) {
let WIDTH_KEY = "width";
let HEIGHT_KEY = "height";
let largerSide = src.height > src.width ? HEIGHT_KEY : WIDTH_KEY;
let smallerSide = largerSide == HEIGHT_KEY ? WIDTH_KEY : HEIGHT_KEY;
let aspectRatio = src[smallerSide]/src[largerSide];
src[largerSide] = dest[largerSide];
src[smallerSide] = dest[largerSide]*aspectRatio;
@Shilo
Shilo / youtube_big_theater_mode_injection.js
Last active July 13, 2018 11:43
YouTube.com "big theater mode" injection. Gives the video full height when in theater mode.
(function() {
var coverNavBar = true;
var css = `
ytd-watch:not([fullscreen])[theater] #player.ytd-watch {
height: ` + (coverNavBar?'':'calc(') + '100vh' + (coverNavBar?'':' - 56px)') + ` !important;
max-height: none !important;` + (coverNavBar?`
position: relative;
margin-top: -56px;
z-index: 9999;