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 UnityEngine; | |
/// <summary> | |
/// This is a simple implementation of applying the screen's safe area to the UI. | |
/// | |
/// To use it, create a Panel as child of your Canvas object, | |
/// configure it to cover the entire Canvas (center pivot and stretched in x and y); | |
/// and add UISafeArea as a component of the Panel. | |
/// | |
/// If the project does not use screen rotation, set screenCanRotate to 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
/// <summary> | |
/// Class Circumference | |
/// </summary> | |
public static class Circumference | |
{ | |
/// <summary> | |
/// Clamps the circumference to a [0..1] float | |
/// <example>For example: | |
/// <code> | |
/// float f = ZeroOneClamp(1.2f); |
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
/** | |
* Shuffles an array and optionally returns a specified number of elements from the shuffled array. | |
* | |
* @param {Array} arr - The array to be shuffled. | |
* @param {number} [size=0] - The number of elements to return from the shuffled array. | |
* If 0, the entire shuffled array is returned. Defaults to 0. | |
* @returns {Array} A new array containing the shuffled elements. If `size` is specified, | |
* the array will contain only the first `size` elements of the shuffled array. | |
* | |
* @example |
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
/* | |
* Middle Truncate Text | |
* | |
* Example: middleTruncateText('123456789', 3), returns "123...789" | |
* | |
* @param {string} text - The text to be truncated | |
* @param {number} visibleSize - Number of chars on each side (default 5) | |
* @param {string} ellipsis - The string to place on truncated text (default '...') | |
*/ | |
export const middleTruncateText: ( |
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
/* | |
* Validate Brazilian CPF number with Typescript | |
* | |
* @param {string} cpf - A string because can start with 0 | |
*/ | |
export const validateCpf: (cpf: string) => (boolean) = (cpf) => { | |
const _cpf = cpf.replace(/\D/g, ''); | |
if (_cpf.length < 11) { | |
return false; |