Skip to content

Instantly share code, notes, and snippets.

View shanecelis's full-sized avatar

Shane Celis shanecelis

View GitHub Profile
@shanecelis
shanecelis / Context.cs
Created April 20, 2020 09:55
Provides a thread-safe global or thread-local context to store a value
// Java Genetic Algorithm Library.
// Copyright (c) 2017 Franz Wilhelmstötter
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
# feature: Add beta sequence.
# ^-----^ ^----------------^
# | |
# | +-> Summary in present tense sentence.
# |
# +-------> Type: binary, chore, doc, excise, feature, fix, hack, legal, refactor,
# style, or test.
@shanecelis
shanecelis / spider-eyes.svg
Created September 26, 2019 04:52
Encode the left half of spider eye patterns in simple shapes. See tweet: https://twitter.com/shanecelis/status/1177076559301287937
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@shanecelis
shanecelis / TextImporter.cs
Last active August 21, 2019 15:46
Import files with the extensions you specify as text assets in Unity 3D.
/* Original code[1] Copyright (c) 2019 Shane Celis[2]
Licensed under the MIT License[3]
[1]: https://gist.github.com/shanecelis/5c38ce90cca057e857f415108f5ac75a
[2]: https://github.com/shanecelis
[3]: https://opensource.org/licenses/MIT
*/
using UnityEngine;
using UnityEditor.Experimental.AssetImporters;
(defun magit-status-parent ()
"Open the magit status of a parent git repository. Useful for
dealing with submodules. Suggest binding to SPC g p for Spacemacs.
(spacemacs/set-leader-keys \"gp\" 'magit-status-parent)
"
(interactive)
(let* ((child-directory (magit-toplevel default-directory))
(parent-directory (and child-directory
(magit-toplevel (file-name-directory
@shanecelis
shanecelis / OrderedPhysicsRaycaster.cs
Last active July 5, 2019 20:24
Ordered raycaster for casting against 3D Physics components. https://twitter.com/shanecelis/status/1146822575978373120
/* Original code[1] Copyright (c) 2019 Shane Celis[2]
Licensed under the MIT License[3]
This comment generated by code-cite[4].
[1]: https://gist.github.com/shanecelis/7881b64ce07ee399f9c2928d977de8c6
[2]: https://github.com/shanecelis
[3]: https://opensource.org/licenses/MIT
[4]: https://github.com/shanecelis/code-cite
*/
@shanecelis
shanecelis / PriorityPhysicsRaycaster.cs
Last active July 5, 2019 20:24
Prioritized raycaster for casting against 3D Physics components. https://twitter.com/shanecelis/status/1146822575978373120
/* Original code[1] Copyright (c) 2019 Shane Celis[2]
Licensed under the MIT License[3]
This comment generated by code-cite[4].
[1]: https://gist.github.com/shanecelis/5379ed7c634222dc979e09e728ef0a6c
[2]: https://github.com/shanecelis
[3]: https://opensource.org/licenses/MIT
[4]: https://github.com/shanecelis/code-cite
*/
@shanecelis
shanecelis / Renamer.cs
Last active June 10, 2019 15:28
Unity utility to rename game objects for use as headers in the scene hierarchy.
/* Original code[1] Copyright (c) 2019 Shane Celis[2]
Licensed under the MIT License[3]
[1]: https://gist.github.com/shanecelis/557b30f46b534a80047b9f2969a94c6e
[2]: https://github.com/shanecelis
[3]: https://opensource.org/licenses/MIT
*/
using UnityEngine;
using UnityEditor;
@shanecelis
shanecelis / MyPhysicsRaycaster.cs
Last active June 5, 2019 05:49
A fix for Unity's PhysicsRaycaster that would throw NullReferenceExceptions when Max Ray Intersections is not zero.
// https://bitbucket.org/Unity-Technologies/ui/raw/9f418c4767c47d0c71f1727eb42a9a9024e9ecc0/UnityEngine.UI/EventSystem/Raycasters/PhysicsRaycaster.cs
using UnityEngine.UI;
using System;
using System.Collections.Generic;
using System.Reflection;
namespace UnityEngine.EventSystems
{
/// <summary>
/// Simple event system using physics raycasts.
@shanecelis
shanecelis / PreviewGUIEditor.cs
Last active May 7, 2019 14:35
Show the `ToString()` of a MonoBehavior in the preview GUI. https://twitter.com/shanecelis/status/1123263828983201794
/* Original code[1] Copyright (c) 2019 Shane Celis[2]
Licensed under the MIT License[3]
This comment generated by code-cite[4].
[1]: https://gist.github.com/shanecelis/b012b573139ae83d40d93f6b402ab492
[2]: https://github.com/shanecelis
[3]: https://opensource.org/licenses/MIT
[4]: https://github.com/shanecelis/code-cite
*/