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 / 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>
@DevEarley
DevEarley / angular-select.component.html
Last active June 17, 2020 23:49
Using ngModel to Select something with Angular. With disabled options, callback and default value.
<select [ngModel]="vm.selectedThing"
(ngModelChange)="onSelectThing($event)">
<option [value]="null">-</option>
<option *ngFor="let thing of vm.things"
[value]="thing.id"
[disabled]="thing.isDisabled">
{{thing.name}}
</option>
</select>
@DevEarley
DevEarley / AreRectanglesColliding.ts
Last active April 20, 2020 01:19
"AB" collision of two rectangles
type Rectangle = {
x: number,
y: number,
h: number,
w: number
}
function areRectanglesColliding(a: Rectangle, b: Rectangle) {
const i = a.x < (b.x + b.w);
const ii = b.x < (a.x + a.w);
@DevEarley
DevEarley / UsingNVM.md
Last active April 9, 2020 21:01
Using NVM
@DevEarley
DevEarley / arrayTo3DGrid.js
Last active March 29, 2020 23:25
Convert a 1D array into a 3D grid
function arrayTo3DGrid(xMax, yMax, zMax) {
let vertices = []
let totalVertices = xMax * yMax * zMax;
let xySquare = xMax * yMax;
for (let i = 0; i < totalVertices; i++) {
let x = i % xMax;
let z = Math.floor(i / (xySquare));
let ii = i - (z * xySquare);
let y = Math.floor(ii / xMax);
vertices.push(x, y, z);
@DevEarley
DevEarley / fix.py
Created January 26, 2020 01:59
Fix all files in a folder with python
import os
folder = 'D:\Projects\python\poems_need_fixing\\'
for filename in os.listdir(folder):
full_filename = folder+filename
print " START " + filename
r = open(full_filename,'r')
lines = r.readlines()
open(full_filename, "w").close()