Skip to content

Instantly share code, notes, and snippets.

View Starpelly's full-sized avatar
✝️
love jesus the christ and god

Braedon Vale Starpelly

✝️
love jesus the christ and god
View GitHub Profile
@JoshClose
JoshClose / ColorExtensions.cs
Created November 15, 2011 15:21
Changing Color Tint with C#
public static class ColorExtensions
{
/// <summary>
/// Tints the color by the given percent.
/// </summary>
/// <param name="color">The color being tinted.</param>
/// <param name="percent">The percent to tint. Ex: 0.1 will make the color 10% lighter.</param>
/// <returns>The new tinted color.</returns>
public static Color Lighten( this Color color, float percent )
{
@aslakhellesoy
aslakhellesoy / rounding.java
Created August 9, 2011 16:18
Rounding up and down to nearest multiple
/** round n down to nearest multiple of m */
long roundDown(long n, long m) {
return n >= 0 ? (n / m) * m : ((n - m + 1) / m) * m;
}
/** round n up to nearest multiple of m */
long roundUp(long n, long m) {
return n >= 0 ? ((n + m - 1) / m) * m : (n / m) * m;
}