Skip to content

Instantly share code, notes, and snippets.

View manuelhe's full-sized avatar
🏕️
6 years quarantined

Manuel Herrera manuelhe

🏕️
6 years quarantined
View GitHub Profile
private setExpiresAt() {
const endDate = this.event.endDate * 1000;
const now = Date.now();
const expirationLimit = 72; // time in hours
// Event already expired
this.expiresAt = this.translate.instant('expired_event');
console.log(now - endDate);
if (now - endDate <= 47 * 3600 * 1000) {
// If the event ended {{expirationLimit}} or less ago
const expDays = (expirationLimit / 24) - Math.ceil((now - endDate) / (24 * 3600000));
@manuelhe
manuelhe / Tools.php
Created May 2, 2013 19:32
URL-safe strings encryption/decryption
<?php
class Tools{
/**
* URL safe string encryption method
*
* @param string $string
* @param string $key
* @return string Returns an url safe encrypted string
* @throws \InvalidArgumentException
*/
<?php
class SleepImmersion
{
protected $sheeps = 0;
protected $timestamp = 0;
protected $userStatus = FALSE;
public function __construct(){
$this->timestamp = time();
$this->isUserAsleep();
}