Skip to content

Instantly share code, notes, and snippets.

View ericdrobinson's full-sized avatar

Eric Robinson ericdrobinson

View GitHub Profile
@ericdrobinson
ericdrobinson / cep.d.ts
Created January 3, 2023 18:51
Type Declarations for [some of?] Adobe's custom CEP APIs
/**
* cep.d.ts - Type declarations for Adobe's CEPEngine APIs. These APIs are used by Adobe's
* [CEPEngine_extensions.js](https://github.com/Adobe-CEP/CEP-Resources/blob/master/CEP_11.x/CEPEngine_extensions.js)
* but may be used directly in CEP contexts as well.
*
* **WARNING:** These declarations are not guaranteed to be exhaustive.
*/
/**
@ericdrobinson
ericdrobinson / time_conversion_tests.rs
Created January 1, 2023 03:14
Sample Time Conversion Tests
/// Tests time conversion roundtripping between sample time and seconds using the specified sample
/// rate (`sr`). All possible sample times up-to-and-including the maximum unsigned integer value
/// are tested. This test uses single precision floating point math.
fn test_time_conversion_for_all_sample_lengths_f32(sr: f32) {
let mut sample: u32 = 0;
loop {
let seconds: f32 = sample as f32 / sr;
if sample != (seconds * sr).round() as u32 {
let hours: f32 = (seconds / 3600.).floor();
@ericdrobinson
ericdrobinson / RequireReferenceAttribute.cs
Created April 12, 2017 19:11
Mark a Field as Required in Unity
using System;
using UnityEngine;
[AttributeUsage(AttributeTargets.Field, Inherited = true, AllowMultiple = false)]
public class RequireReferenceAttribute : PropertyAttribute
{
public readonly Color highlight;
public RequireReferenceAttribute()
{
@ericdrobinson
ericdrobinson / ProjectCleaner.cs
Created April 10, 2017 19:03
Prune Empty Folders in Unity Projects
using UnityEngine;
using UnityEditor;
using System.IO;
[InitializeOnLoad]
public class ProjectCleaner
{
static int FilesDeleted = 0;
static int DirsDeleted = 0;