Skip to content

Instantly share code, notes, and snippets.

@OmanCoding
OmanCoding / elapsed.js
Created June 3, 2019 07:03
كيف تنتج أوقات "منذ" مثل مواقع التواصل الاجتماعي
function elapsed(time) {
const $SECONDS = Math.abs(Math.floor(Date.now()/1000) - time);
const $iv_table = [
"ثانية","دقيقة", "ساعة", "يوم", "شهر", "سنة",
"ثانيتين","دقيقتين", "ساعتين", "يومين", "شهرين", "سنتين",
"ثواني","دقائق", "ساعات", "أيام", "أشهر", "سنوات"]
const $iv = [$SECONDS, // ثانية
($SECONDS - ($SECONDS%60))/60, // دقيقة
($SECONDS - ($SECONDS%3600))/3600, // ساعة
($SECONDS - ($SECONDS%(3600*24)))/(3600*24), // يوم
const rp = require("request-promise");
const cheerio = require("cheerio");
var Crawler = require("crawler");
const baseURL = "https://techterms.com/category/software";
const getSoftwareTerms = async () => {
const html = await rp(baseURL);
let list = [];
const $ = cheerio.load(html);
$("tbody td a").each(function(index, element) {
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
int
main (void)
{
int n;
int g;
char c;
srand (time (NULL));
extends layout
block content
table
tr
th Name
th Company
th Email
th City
th Country