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
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks. | |
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/) | |
(() => { | |
const SHOW_SIDES = false; // color sides of DOM nodes? | |
const COLOR_SURFACE = true; // color tops of DOM nodes? | |
const COLOR_RANDOM = false; // randomise color? | |
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com) | |
const MAX_ROTATION = 180; // set to 360 to rotate all the way round | |
const THICKNESS = 20; // thickness of layers | |
const DISTANCE = 10000; // ¯\\_(ツ)_/¯ |
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
/** | |
* \brief Returns positional offset for a given point as a result of summing 4 gerstner waves | |
* \param positionWS point in world space | |
* \param wavelengths wavelength of each of the 4 waves | |
* \param amplitudes amplitudes of each of the 4 waves | |
* \param directions direction of each of the 4 waves (each row = one direction). MUST BE NORMALIZED! | |
* \param speed global speed multiplier. Individual wave speed depends on Wavelength | |
* \param steepness Gerstner wave 'Steepness' parameter. Modulates the horizontal offset of points | |
* \param normal returns the normal of given point. | |
* \return positional offset of the given point |
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.Collections.Generic; | |
using System.Linq; | |
using UnityEditor; | |
using UnityEditor.Callbacks; | |
using UnityEditor.Compilation; | |
using UnityEngine; | |
public static class FlyoutProjectWindow | |
{ |
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
// Revision history | |
// Rev 1 16/MAY/2021 initial | |
// Rev 2 23/AUG/2021 add support for array property path | |
// Rev 3 23/AUG/2021 cache using type+path (s_PathHashVsType) | |
// Rev 4 23/AUG/2021 properly handling array and list by stealing code from Unity CS reference | |
using System; | |
using System.Collections.Generic; | |
using System.Reflection; | |
using UnityEditor; |
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
---------------------------------------------------------------------- | |
-- Generate Normal Map | |
-- | |
-- It works only for RGB color mode. | |
---------------------------------------------------------------------- | |
if app.apiVersion < 1 then | |
return app.alert("This script requires Aseprite v1.2.10-beta3") | |
end | |
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 UnityEngine; | |
public static class Extensions_Math | |
{ | |
// ... | |
public static float VectorToRad(this Vector2 thisVec){ | |
return Mathf.Atan2(thisVec.y, thisVec.x); |
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
/* | |
* This is an implementation of wcwidth() and wcswidth() (defined in | |
* IEEE Std 1002.1-2001) for Unicode. | |
* | |
* http://www.opengroup.org/onlinepubs/007904975/functions/wcwidth.html | |
* http://www.opengroup.org/onlinepubs/007904975/functions/wcswidth.html | |
* | |
* In fixed-width output devices, Latin characters all occupy a single | |
* "cell" position of equal width, whereas ideographic CJK characters | |
* occupy two such cells. Interoperability between terminal-line |
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
// ⚠ IMPORTANT: this is old and doesn't work for many different edge cases but I'll keep it as-is for any of you want it | |
// ⚠ IMPORTANT: you can find more robust versions in the comments or use a library implementation such as lodash's `merge` | |
// Merge a `source` object to a `target` recursively | |
const merge = (target, source) => { | |
// Iterate through `source` properties and if an `Object` set property to merge of `target` and `source` properties | |
for (const key of Object.keys(source)) { | |
if (source[key] instanceof Object) Object.assign(source[key], merge(target[key], source[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
// JS array equivalents to C# LINQ methods - by Dan B. | |
// First: This version using older JavaScript notation for universal browser support (scroll down for ES6 version): | |
// Here's a simple array of "person" objects | |
var people = [ | |
{ name: "John", age: 20 }, | |
{ name: "Mary", age: 35 }, | |
{ name: "Arthur", age: 78 }, | |
{ name: "Mike", age: 27 }, |
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
/* | |
* Created by C.J. Kimberlin | |
* | |
* The MIT License (MIT) | |
* | |
* Copyright (c) 2019 | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights |
NewerOlder