Skip to content

Instantly share code, notes, and snippets.

View linadk's full-sized avatar

linadk linadk

  • Boston, MA
View GitHub Profile
@linadk
linadk / set_corner_preference.rs
Created March 22, 2024 21:02
Sets the corner rounding preferences in windows 11. Works with Tao's window handle hwnd() method.
#[cfg(target_os = "windows")]
use windows::Win32::Graphics::Dwm::{
DwmSetWindowAttribute,
DWM_WINDOW_CORNER_PREFERENCE,
DWMWA_WINDOW_CORNER_PREFERENCE,
DWMWCP_ROUND, DWMWCP_ROUNDSMALL, DWMWCP_DEFAULT, DWMWCP_DONOTROUND,
};
use windows::Win32::Foundation::HWND;
use core::mem;
@linadk
linadk / linspace.ts
Created February 24, 2024 17:01
A Float64 linspace(...) function that can handle ascending/descending
/**
* Generate a Float64 array of linearly spaced values.
* @param start Number representing the starting point of this linear space.
* @param stop Number Representing the endpoint of this linear space.
* @param step Step size through the linear space. Always positive, sign determined by range.
* @returns An array of evenly spaced elements specified by start,stop,step.
* @example
* ```
* const s = linspace(0,1,0.1)
* > [0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1]
@linadk
linadk / Observer.ts
Created February 23, 2024 16:05
A TypeScript observer pattern implementation that uses UIDs for lookup
"use strict";
/**
* Contains interfaces for the Observer design pattern.
*/
/**
* Base Observer class that uses unique id system to make lookups more efficient.
*
* @example
@linadk
linadk / LightColorAnimation.cs
Created March 26, 2016 00:41
Unity3D Light Animation ( Intensity & Color )
/// <summary>
/// Gives a suite of options for variances in light color and intensity over time.
/// Credit to Harry1960 and the posters in http://forum.unity3d.com/threads/flickering-light.4988/ for the bulk of the code.
/// I added in intermitent animation options to help achieve a more realistic light flicker.
/// </summary>
using UnityEngine;
using System.Collections;
public enum enColorchannels
@linadk
linadk / UnetHelloWorld
Created June 19, 2015 18:37
Using the Unity3d Unet LLAPI this will establish a connection and send data. There aren't many examples out there for this currently so I thought I'd write this up.
/// <summary>
/// UNet LLAPI Hello World
/// This will establish a connection to a server socket from a client socket, then send serialized data and deserialize it.
/// </summary>
using UnityEngine;
using System.Collections;
using UnityEngine.Networking;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;