Skip to content

Instantly share code, notes, and snippets.

Avatar

Shilo Shilo

View GitHub Profile
@mxalbert1996
mxalbert1996 / Scrollbar.kt
Last active Sep 13, 2022
Modifiers to draw scrollbars in Jetpack Compose
View Scrollbar.kt
/*
* 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
@BoQsc
BoQsc / Gists.md
Last active Aug 16, 2022
How to search my own Gists
View Gists.md
@Shilo
Shilo / export_aseprite_layers.bat
Created Apr 27, 2019
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)
View export_aseprite_layers.bat
@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
)
@Shilo
Shilo / aspect_fit_bounds_in_bounds.js
Last active Aug 21, 2018
Javascript snippet to aspect fit bounds in bounds.
View aspect_fit_bounds_in_bounds.js
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 Jul 13, 2018
YouTube.com "big theater mode" injection. Gives the video full height when in theater mode.
View youtube_big_theater_mode_injection.js
(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;
@gaearon
gaearon / modern_js.md
Last active Sep 25, 2022
Modern JavaScript in React Documentation
View modern_js.md

If you haven’t worked with JavaScript in the last few years, these three points should give you enough knowledge to feel comfortable reading the React documentation:

  • We define variables with let and const statements. For the purposes of the React documentation, you can consider them equivalent to var.
  • We use the class keyword to define JavaScript classes. There are two things worth remembering about them. Firstly, unlike with objects, you don't need to put commas between class method definitions. Secondly, unlike many other languages with classes, in JavaScript the value of this in a method [depends on how it is called](https://developer.mozilla.org/en-US/docs/Web/Jav
View nightbot_commands_selected.md

Nightbot Commands (Selected)

Basic Counter (execute works for mod-only)

!commands add !countercmd -ul=moderator "The current counter is $(count) ."

Reset Counter Command (execute works for mod-only)

!commands add !resetcountercmd -ul=moderator -a=!commands edit !countercmd -c=0

@matthewzring
matthewzring / markdown-text-101.md
Last active Sep 25, 2022
A guide to Markdown on Discord.
View markdown-text-101.md

Markdown Text 101

Want to inject some flavor into your everyday text chat? You're in luck! Discord uses Markdown, a simple plain text formatting system that'll help you make your sentences stand out. Here's how to do it! Just add a few characters before & after your desired text to change your text! I'll show you some examples...

Sweet Styles

Italics *italics* or _italics_

Underline italics __*underline italics*__

@whaison
whaison / CSharpReNameFileNameExtention_And_Meta.cs
Last active May 30, 2019
Unity AssetDatabase.RenameAsset(path, newName); can not rename extension CSharpReNameFileNameExtention_And_Meta(string path,string newName) can chenge extension
View CSharpReNameFileNameExtention_And_Meta.cs
static public void CSharpReNameFileNameExtention_And_Meta(string path,string newName)
{
string[] pathArr = path.Split("/"[0]);
string tempStr = "";
for (int i = 0; i < pathArr.Length-1; i++)
{
tempStr = tempStr + pathArr[i]+"/";
}
string renameDir = tempStr;
@Guendeli
Guendeli / ToastMessage.cs
Created Sep 28, 2016
a script to show Toast Messages on Android Unity3D Apps
View ToastMessage.cs
using UnityEngine;
public class ToastMessage : MonoBehaviour
{
string toastString;
string input;
AndroidJavaObject currentActivity;
AndroidJavaClass UnityPlayer;
AndroidJavaObject context;