Skip to content

Instantly share code, notes, and snippets.

View abou7mied's full-sized avatar
🏠
Working from home

Ahmed Sabry abou7mied

🏠
Working from home
  • Egypt, Zagazig
View GitHub Profile
const rp = require('request-promise-native');
async function getTzId(apiKey) {
const response = await rp({
url: `https://onlinesim.ru/api/getNum.php?apikey=${apiKey}&service=other`,
method: 'GET',
});
// 97833
if (response.response === 1) {
return response.tzid;
const showDuration = startTime => {
let interval;
const formatTime = () => {
const distance = Date.now() - new Date(startTime);
let hours = Math.floor(
(distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)
);
let minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
let seconds = Math.floor((distance % (1000 * 60)) / 1000);
hours = hours < 10 ? "0" + hours : hours;
@abou7mied
abou7mied / index.hbs
Created December 26, 2019 06:16
connect-flash + hbs example
<html>
<body>
{{#each messages}}
Message: {{this}}
{{/each}}
</body>
</html>
@abou7mied
abou7mied / Keys.java
Last active March 7, 2018 21:47
Generate java class from javascript keys file
package app.package;
public class Keys {
public static final String USER_NAME = "username";
public static class Post {
public static final String TITLE = "post_title";
}
@abou7mied
abou7mied / script.js
Created May 25, 2017 14:45
Download the whole photos in a Facebook post
// var fbPhotosPhotoActionsItem
function getHttp(url, cb) {
let http = new XMLHttpRequest();
http.open("GET", url, true);
http.onreadystatechange = function () {
if (http.readyState === 4)
cb(null, http.responseURL);
}