Skip to content

Instantly share code, notes, and snippets.

View bogere's full-sized avatar
🎯
Focusing

Bogere Goldsoft bogere

🎯
Focusing
View GitHub Profile
@bogere
bogere / wp-db.tutorial.php
Created January 23, 2020 07:32 — forked from benbalter/wp-db.tutorial.php
WordPress DB Tutorial
<?php
//absolute path to wp-load.php, or relative to this script
//e.g., ../wp-core/wp-load.php
include( 'trunk/wp-load.php' );
//grab the WPDB database object, using WP's database
//more info: http://codex.wordpress.org/Class_Reference/wpdb
global $wpdb;
@bogere
bogere / gist:aa89bcd321be315ec35a79799df0cba0
Created December 4, 2017 21:53 — forked from codeincontext/gist:1285806
Javascript function to show how long ago a timestamp was as a pretty string
function timeAgo(time){
var units = [
{ name: "second", limit: 60, in_seconds: 1 },
{ name: "minute", limit: 3600, in_seconds: 60 },
{ name: "hour", limit: 86400, in_seconds: 3600 },
{ name: "day", limit: 604800, in_seconds: 86400 },
{ name: "week", limit: 2629743, in_seconds: 604800 },
{ name: "month", limit: 31556926, in_seconds: 2629743 },
{ name: "year", limit: null, in_seconds: 31556926 }
];