Skip to content

Instantly share code, notes, and snippets.

@astuyve
astuyve / deny_snippet.json
Created January 17, 2024 15:00
Deny cloudwatch permissions from Lambda to save money
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Deny",
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"
],
@mitchellh
mitchellh / merge_vs_rebase_vs_squash.md
Last active April 22, 2024 16:22
Merge vs. Rebase vs. Squash

I get asked pretty regularly what my opinion is on merge commits vs rebasing vs squashing. I've typed up this response so many times that I've decided to just put it in a gist so I can reference it whenever it comes up again.

I use merge, squash, rebase all situationally. I believe they all have their merits but their usage depends on the context. I think anyone who says any particular strategy is the right answer 100% of the time is wrong, but I think there is considerable acceptable leeway in when you use each. What follows is my personal and professional opinion:

class PathMe {
moves: string[] = [];
constructor() {
this.moves = [];
return this;
}
moveTo(x: number, y: number) {
@DonjiKong
DonjiKong / gist:b98bcc47c76e1c983acd8e0032693987
Created March 15, 2023 07:40
The 3 prompts for generating a novel
// Prompt 1:
Can you tell me a story about an adventurer named Donji, and his adventures to find a dragon friend (whose name will be fizz) and rescue the princess with his trusty glass sword and beginner computer programming skills. My goal for the story is to go to sleep. This story should have named chapters.
But before you tell me a story, I want you to make a 20 chapter outline with chapter titles. And don’t tell me the story until I tell you to.
The format should be like this:
Chapter X: Title
***************************************************************************
@shanecelis
shanecelis / DragManipulator.cs
Last active March 31, 2024 15:58
This manipulator makes a visual element draggable at runtime in Unity's UIToolkit.
/* Original code[1] Copyright (c) 2022 Shane Celis[2]
Licensed under the MIT License[3]
[1]: https://gist.github.com/shanecelis/b6fb3fe8ed5356be1a3aeeb9e7d2c145
[2]: https://twitter.com/shanecelis
[3]: https://opensource.org/licenses/MIT
*/
using UnityEngine;
using UnityEngine.UIElements;
@shanecelis
shanecelis / ChildAnnotator.cs
Last active April 5, 2023 10:30
Fake CSS pseudo classes :first-child and :last-child in Unity's UIToolkit with regular USS classes .first-child and .last-child.
/* Original code[1] Copyright (c) 2022 Shane Celis[1]
Licensed under the MIT License[1]
[1]: https://gist.github.com/shanecelis/1ab175c46313da401138ccacceeb0c90
[1]: https://twitter.com/shanecelis
[1]: https://opensource.org/licenses/MIT
*/
using UnityEngine.Scripting;
using UnityEngine.UIElements;
@alexanderameye
alexanderameye / SceneSwitcherToolbarOverlay.cs
Last active December 1, 2023 22:37
A small scene switcher utility for Unity
using System.Collections.Generic;
using System.IO;
using UnityEditor;
using UnityEditor.Overlays;
using UnityEditor.SceneManagement;
using UnityEditor.Toolbars;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UIElements;
@staggartcreations
staggartcreations / GlobalShaderParams.cs
Last active January 18, 2024 08:40
Component for passing values through Shader.SetGlobalXXX
using System;
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
[ExecuteInEditMode]
public class GlobalShaderParams : MonoBehaviour
{
@totallyRonja
totallyRonja / MovingParticleContext.cs
Last active December 25, 2022 07:53
This script allows you to display movement of particle systems without them moving for tweaking them in the editor. This script is CC0, but I'd be happy if you credit me as Ronja(https://twitter.com/totallyRonja) and maybe give me some money for what I do (https://www.patreon.com/RonjaTutorials) (https://ko-fi.com/ronjatutorials)
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using UnityEngine;
using UnityEditor;
using UnityEditor.EditorTools;
// Tagging a class with the EditorTool attribute and no target type registers a global tool. Global tools are valid for any selection, and are accessible through the top left toolbar in the editor.
[EditorTool("Moving Particle Context")]
@totallyRonja
totallyRonja / MaterialGradientDrawer.cs
Last active September 26, 2023 09:46
A Material Property Drawer for the [Gradient] attribute which lets you edit gradients and adds them to the shader as textures. More information here: https://twitter.com/totallyRonja/status/1368704187580682240
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEngine;
using Object = UnityEngine.Object;
public class MaterialGradientDrawer : MaterialPropertyDrawer {
private int resolution;