Skip to content

Instantly share code, notes, and snippets.

View DevEarley's full-sized avatar
🎯
Focusing

Alex Earley DevEarley

🎯
Focusing
View GitHub Profile
@DevEarley
DevEarley / A-Delegate-pattern-in-Uniy3D.md
Last active October 10, 2022 20:46
Delegate pattern in Uniy3D

Delegate pattern in Uniy3D

  • A delegate is something that acts on another thing's behalf.

  • So if Thing A needed something, Thing B to Thing Z could deliver that to Thing A. This makes Things B to Z all delegates to Thing A. Thing A invokes a delegate function. Thing A doesn't care who runs the errand. Thing A doesn't care how it happens. As long as it happens.

Delegate Invoker

@DevEarley
DevEarley / fe-testing.md
Last active April 1, 2022 15:24
Notes on front end testing

Notes on Frontend Testing

Use Data Attributes Rather Than CSS Selectors.

... choose selectors less prone to change. My favorite type of selector is the data attribute. A developer is less likely to change data attributes while refactoring, making them perfect for locating elements in tests. I recommend naming them in a meaningful way to clearly convey their purpose to any developers working on the source code.

* Frontend Testing Pitfalls

Don't Use AAA, Use BDD!

AAA refers to Arrange, Act, Assert. This is a tried and true pattern for unit testing things like APIS. But does that work for something like integration testing with the DOM? Consider another approach, behavioral-driven development (BDD).

@DevEarley
DevEarley / psm.cmd
Created March 31, 2022 19:56
PSM - Commit and Push all Submodules
echo off
git submodule foreach "git add . || :"
git submodule foreach "git commit -m \"%*\" || :"
git submodule foreach "git push || :"
git add .
git commit -m "%*"
git push
@DevEarley
DevEarley / VertexColor.shader
Last active March 19, 2022 14:15
Shader that works well with Unity3d. Tested with Collada file that had vertex colors.
Shader "Custom/VertexColorEmissive"
{
Properties
{
_MainTex("Color (RGB) Alpha (A)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic("Metallic", Range(0,1)) = 0.0
_Emissive ("Emissive", Range(0,1)) = 1.0
_Cutoff("Alpha cutoff", Range(0,1)) = 0.2
}
@DevEarley
DevEarley / convert-flv-to-mp4.cmd
Last active December 8, 2020 17:32
FFMPEG FLV to MP4 converter
ffmpeg -i "./%*.flv" -c:v libx264 -crf 19 -strict experimental "./%*.mp4"
@DevEarley
DevEarley / Windows Explorer Commands.md
Last active September 21, 2020 14:34
Windows Explorer Commands
documents - opens your Documents folder.
downloads - opens your Downloads folder.
favorites - opens the Favorites folder from your Windows 10's Internet Explorer.
pictures - opens your Pictures folder.
videos - opens your Videos folder.
calc - opens the Calculator app.
cleanmgr - opens Disk Cleanup.
compmgmt.msc or compmgmtlauncher - opens the Computer Management console.
control - launches Control Panel.
@DevEarley
DevEarley / CharacterMotionAndAnimation.cs
Last active March 3, 2024 08:30
Character Motion And Animation script for Unity
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CharacterMotionAndAnimation : MonoBehaviour
{
public Animator animator;
public GameObject camera;
public CharacterController controller;
public Vector3 playerVelocity;
@DevEarley
DevEarley / MicroBlog.js
Last active September 2, 2020 14:55
Micro Blog
(function () {
let files = [
'readme.md'
];
let converter = new showdown.Converter();
let entries = [];
function updateBlog(_entries, _files) {
let blog = document.getElementById("MicroBlog");
if (blog != null) {
@DevEarley
DevEarley / my.pipe.ts
Last active July 6, 2020 15:04
Angular pipe
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'myPipe'
})
export class MyPipe implements PipeTransform {
transform(value, args?) {
return //... logic goes here ...
}
}
@DevEarley
DevEarley / react-starter.html
Created June 19, 2020 22:11
React Starter with JSX
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>React Starter</title>
<script src="https://unpkg.com/react@16/umd/react.development.js" crossorigin></script>