Skip to content

Instantly share code, notes, and snippets.

View wrilben's full-sized avatar
🎯
Focusing

Benedict Asamoah wrilben

🎯
Focusing
View GitHub Profile
This file has been truncated, but you can view the full file.
<?xml version="1.0"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CatalogVersion</key>
<integer>2</integer>
<key>ApplePostURL</key>
<string>http://swpost.apple.com/stats</string>
<key>IndexDate</key>
<date>2020-04-10T23:27:27Z</date>
Your task in order to complete this Kata is to write a function which formats a duration, given as a number of seconds, in a human-friendly way.
The function must accept a non-negative integer. If it is zero, it just returns "now". Otherwise, the duration is expressed as a combination of years, days, hours, minutes and seconds.
It is much easier to understand with an example:
```
format_duration(62) # returns "1 minute and 2 seconds"
format_duration(3662) # returns "1 hour, 1 minute and 2 seconds"
```

Keybase proof

I hereby claim:

  • I am benedictasamoah on github.
  • I am wrilben (https://keybase.io/wrilben) on keybase.
  • I have a public key ASCmX6uxcnGG29Bu23WdY22oOHLMHxPYZytwbZYLZF6zngo

To claim this, I am signing this object:

@wrilben
wrilben / eventsAggregator.php
Last active August 12, 2019 01:12
Aggregate Events from Facebook, Eventbrite, Meetup and other platforms using a geo-location
<?php
// Generate geo location using Ip Address
$user_ip = 'getenv('REMOTE_ADDR')';
$geo = unserialize(file_get_contents("http://www.geoplugin.net/php.gp?ip=$user_ip"));
$country = $geo["geoplugin_countryName"];
$city = $geo["geoplugin_city"];
$lgn = $geo['geoplugin_longitude'];
$lat = $geo['geoplugin_latitude'];
@wrilben
wrilben / GenerateRandomTransactionIds.php
Last active December 21, 2017 10:14
Generate Random Transaction Ids for your projects
<?php
##Author Benedict Asamoah
function generateTransactionID ($data){
## Get passed card information to string
$string = $data;
## Create an array
$store = array();
## create a loop that runs four times
for ($x = 0; $x <= 4; $x++) {
## Get random positions each time the loop is runned