Skip to content

Instantly share code, notes, and snippets.

View muhammedmoussa1's full-sized avatar
🎯
Focusing

Muhammed Moussa muhammedmoussa1

🎯
Focusing
View GitHub Profile
@muhammedmoussa1
muhammedmoussa1 / luhn.js
Created July 7, 2022 23:09 — forked from ShirtlessKirk/luhn.js
Luhn validation algorithm
/**
* Luhn algorithm in JavaScript: validate credit card number supplied as string of numbers
* @author ShirtlessKirk. Copyright (c) 2012.
* @license WTFPL (http://www.wtfpl.net/txt/copying)
*/
var luhnChk = (function (arr) {
return function (ccNum) {
var
len = ccNum.length,
bit = 1,
@muhammedmoussa1
muhammedmoussa1 / Readme.md
Created August 23, 2021 16:17 — forked from ktheory/Readme.md
Easily make HTTPS requests that return promises w/ nodejs

Javascript request yak shave

I wanted to easily make HTTP requests (both GET & POST) with a simple interface that returns promises.

The popular request & request-promises package are good, but I wanted to figure out how to do it w/out using external dependencies.

The key features are:

  • the ability to set a timeout
  • non-200 responses are considered errors that reject the promise.
  • any errors at the TCP socker/DNS level reject the promise.
@muhammedmoussa1
muhammedmoussa1 / iframe.html
Created May 20, 2021 08:58 — forked from cirocosta/iframe.html
Sending messages from child iframe to parent webpage
<!DOCTYPE html>
<html>
<head>
<title>My Iframe</title>
</head>
<body>
<button>Botão</button>
<script type="text/javascript">