Skip to content

Instantly share code, notes, and snippets.

View mattnico's full-sized avatar

Matt Nicolaysen mattnico

  • California, USA
View GitHub Profile
@mattnico
mattnico / format_time
Last active August 29, 2015 13:57
A function to display and amount of time with years, months, weeks, days, hours, minutes, and seconds.
<?php
/**
* An imprecise time formatter for imprecise, nonessential time calculations.
* Formats an amount of time (in seconds, minutes, hours, days, weeks, months, or years)
* to be displayed in years, months, weeks, days, hours, minutes, and seconds.
* For the purposes of this simple formatter, a month is considered 365 / 12 days.
*
* @param int $elapsed The amount of time (in seconds) to format.
* @param string $format The format of the outputted date string.
@mattnico
mattnico / Colorful-Language.markdown
Last active April 14, 2024 16:50
A Javascript function to calculate a unique color for any English word.

Colorful Language

This Javascript will calculate a unique color for any English word typed into it. Currently other alphabets are not supported. Punctuation and white space are ignored.

A Pen by Matt Nicolaysen on CodePen.

License.

if ([adInterstitial ready])
{
[adInterstitial presentWithViewController:self];
}
else
{
adInterstitial = [[FlurryAdInterstitial alloc] initWithSpace:@"INTERSTITIAL"];
[adInterstitial fetchAd];
}