Skip to content

Instantly share code, notes, and snippets.

View SnowRunescape's full-sized avatar
🏠
Working from Estuda.com

Bruno Caitano SnowRunescape

🏠
Working from Estuda.com
View GitHub Profile
@RaasAhsan
RaasAhsan / gist:4083992
Created November 16, 2012 04:14
pitch/yaw to directional vector
// pitch and yaw are in degrees
Vector3D getDirectionVector() {
return new Vector3D(-Math.cos(pitch * Math.PI / 180.0) * Math.sin(yaw * Math.PI / 180.0), Math.sin(pitch * Math.PI / 180.0), -Math.cos(pitch * Math.PI / 180.0) * Math.cos(yaw * Math.PI / 180.0));
}
@squallstar
squallstar / time_ago.php
Last active January 15, 2020 14:09
Posted x time ago (PHP function)
<?php
function time_ago($date,$granularity=2) {
$difference = time() - $date;
$retval = '';
$periods = array('decade' => 315360000,
'year' => 31536000,
'month' => 2628000,
'week' => 604800,
'day' => 86400,
'hour' => 3600,