Skip to content

Instantly share code, notes, and snippets.

@MadLittleMods
MadLittleMods / Pendulum.cs
Last active April 20, 2024 17:20
A Unity script to Simulate Pendulum Motion
using UnityEngine;
using System.Collections;
// Author: Eric Eastwood (ericeastwood.com)
//
// Description:
// Written for this gd.se question: http://gamedev.stackexchange.com/a/75748/16587
// Simulates/Emulates pendulum motion in code
// Works in any 3D direction and with any force/direciton of gravity
//
@MadLittleMods
MadLittleMods / TextAreaWithTabs.cs
Created May 20, 2015 04:23
Unity GUI text area: `MLMEditorGUI.TextAreaWithTabs(Rect position, string text)`
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Reflection;
using self = MLMEditorGUI;
using System.Collections.Generic;
public class MLMEditorGUI : MonoBehaviour {

How to Use?

GUIStyle mystyle = new GUIStyle("some string from the list below");


UnityEditor.ConsoleWindow.Constants

  • "CN Box"
  • "Button"
@MadLittleMods
MadLittleMods / eufy-robovac-25c.md
Last active November 12, 2023 04:38
Fixing a main rolling brush that is "stuck" on a Eufy RoboVac 25c (Robot Vacuum)
@MadLittleMods
MadLittleMods / reverse-iterate.zig
Created November 4, 2023 06:38
Reverse iterate over a array/list in Zig
const std = @import("std");
pub fn main() void {
var list = [_]u8{ 1, 2, 3, 4, 5, 6, 7, 8, 9 };
// `i = i -% 1` is wrapping subtraction.
// `i -%= 1`
var i: u32 = list.len - 1;
while (i < list.len) : (i -%= 1) {
std.log.debug("i: {d} list[{d}] -> {d}", .{ i, i, list[i] });

Autodesk Fusion 360

Autodesk Fusion 360 is free for personal use. It is a CAD program like Autodesk Inventor(which can be free if you have a .edu student school email address). I was familiar with Inventor and found Fusion 360 pretty similar with nice parametric modeling.

  • You can have multiple components in one design (and apply some assembly contraints)
  • For the blueprint type view that you can annotate and add dimensions, it is called a "drawing"

Random guides

@MadLittleMods
MadLittleMods / split-long-string-across-multiple-lines.zig
Last active October 13, 2023 01:35
Break-up long string across multiple lines in Zig (combine strings)
const std = @import("std");
// See "a ++ b" in the Zig docs: https://ziglang.org/documentation/master/#Operators
pub fn main() void {
std.log.debug(
"We can split up a really long string across multiple lines in Zig using " ++
"the ++ operator which works on comptime known arrays. Since comptime " ++
"strings look like `[100:0]const u8` indicating a null terminated array of " ++
"integers that is 100 characters long, this works just fine.",
.{},
const std = @import("std");
const expect = std.testing.expect;
const expectEqual = std.testing.expectEqual;
const expectEqualSlices = std.testing.expectEqualSlices;
// Tested with Zig 0.11.0
// `zig run x11-flexible-array-member-parsing.zig`
// This is a barebones example from zigx and the code to parse the connection setup buffer,
// https://github.com/marler8997/zigx/blob/a313162bdac3182c7fc38a31dfa952c68ff861f9/x.zig#L2386-L2481