This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using System.Collections.Generic; | |
public static class Pathfinding | |
{ | |
/// <summary> | |
/// A* implementation. Finds a path from start to goal. | |
/// </summary> | |
/// <param name="start">Where to begin.</param> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Vertically flips a render texture in-place. | |
/// </summary> | |
/// <param name="target">Render texture to flip.</param> | |
public static void VerticallyFlipRenderTexture(RenderTexture target) | |
{ | |
var temp = RenderTexture.GetTemporary(target.descriptor); | |
Graphics.Blit(target, temp, new Vector2(1, -1), new Vector2(0, 1)); | |
Graphics.Blit(temp, target); | |
RenderTexture.ReleaseTemporary(temp); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Text.RegularExpressions; | |
using UnityEngine; | |
/// <summary> | |
/// Holds the result of parsing the ytInitialPlayerResponse JSON from a YouTube page. | |
/// </summary> | |
/// <remarks> | |
/// This is an incomplete list of fields in ytInitialPlayerResponse. | |
/// The full object contains many more, but we only care about a few. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$wshell = New-Object -ComObject WScript.Shell | |
while ($true) { | |
Write-Output "$(Get-Date) Toggling numlock" | |
$whell.SendKeys('{NUMLOCK}') | |
Start-Sleep -Seconds 10 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
for filename in "$@"; do | |
base=$(basename "$filename" .mov) | |
mkdir "$base" | |
ffmpeg -i "$filename" "$base/$base-%03d.png" | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_minimal_paths(root_directory, paths_to_exclude=None, paths_to_include=None): | |
""" | |
Gets the "minimal" paths that comprise a directory's contents while excluding a set of child paths. | |
For example, given this directory hierarchy: | |
C:/Engine | |
Binaries | |
Documentation | |
Plugins |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Include "Sockets" in the `PrivateDependencyModuleNames` list in the Build.cs file. | |
#include "SocketSubsystem.h" | |
FString GetHost() | |
{ | |
bool bCanBindAll; | |
return ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM)->GetLocalHostAddr(*GLog, bCanBindAll)->ToString(false); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class StorageArray { | |
private storage: Storage; | |
constructor(storage: Storage) { | |
this.storage = storage; | |
} | |
get(key: string): string[] | null { | |
const jsonString = this.storage.getItem(key); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {forwardRef, useImperativeHandle, useRef} from 'react'; | |
interface Props { | |
children: React.ReactNode; | |
className?: string; | |
collapsedHeight: number; | |
isCollapsed: boolean; | |
transitionDuration?: string; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
actual=$1 | |
expected=$2 | |
# https://stackoverflow.com/a/5947802 | |
GREEN='\033[0;32m' | |
RED='\033[0;31m' | |
RESET='\033[0m' # No Color |