Skip to content

Instantly share code, notes, and snippets.

View a-eid's full-sized avatar
🎯
Focusing

Ahmed Eid a-eid

🎯
Focusing
View GitHub Profile
@a-eid
a-eid / issue.md
Last active June 26, 2017 18:18
medium issue extended

medium

Maybe I was not clear enough so I will explain the issue again after posting the versions you asked about

const $ = document.querySelector.bind(document);
const $$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
};
NodeList.prototype.__proto__ = Array.prototype; // eslint-disable-line
NodeList.prototype.on = NodeList.prototype.addEventListener = function (name, fn) {
""" Tower of Hanoi """
def printMove(fr , to):
print("move from {} to {} ".format(str(fr),str(to)) )
def towers(num , original , dist ,spare):
if num == 1:
printMove(original , dist)
else:
towers(num-1, original , spare , dist) # move the upper stack to spare to
towers(1, original , dist , spare) # move the bigger to to
/* takes single number and convert it to a position
@arg:
Int: number
@returns:
String: position (ie: 1st , 2nd , 3rd , 4th ,... 101st , 1004th ...)
*/
var calcPosition = (rank) => {
let final
let length = rank.toString().length
--length
@a-eid
a-eid / urlencode.js
Created July 12, 2017 05:36
php like urlencode for javascript
// rawurlencode is more or less like encodeURIComponent
function urlencode (str) {
// php like urlencode for javascript
str = (str + '')
return encodeURIComponent(str)
.replace(/!/g, '%21')
.replace(/'/g, '%27')
.replace(/\(/g, '%28')
.replace(/\)/g, '%29')
.replace(/\*/g, '%2A')
@a-eid
a-eid / wtf.js
Created July 21, 2017 16:08 — forked from MichalZalecki/wtf.js
/* VT100 terminal reset (<ESC>c) */
console.log('\033c');
/* numbers comparations */
> '2' == 2
true
> '2' === 2
const cheerio = require("cheerio");
const rp = require("request-promise-native");
(async () => {
const html = await rp(
"https://fr.aliexpress.com/store/product/Summer-Women-Dress-Vestidos-Casual-Clothing-Female-Tropical-Bohemian-Mini-Dress-Beach-Vestidos-De-Renda-Ladies/620009_32282871144.html?spm=a2g05.8005319.2001.3.mH47kQ&sdom=703.123483.111126.0_32282871144"
);
const $ = cheerio.load(html)
const productName = $("h1.product-name")
var el = document.querySelector(".shopper-top-menu");
var elOriginal = el.offsetTop
window.addEventListener("scroll" , function(e){
if( window.scrollY >= el.offsetTop ) {
document.body.style.paddingTop = el.offsetHeight;
el.style.position = "fixed";
el.classList.add("fixed")
el.style.width = "100%";
el.style.top = 0;
el.style.left = 0 ;
@a-eid
a-eid / wget
Last active August 9, 2017 16:32
wget --recursive --no-clobber --page-requisites --html-extension --convert-links --domains website.org --no-parent "http://awhorenextdoor.com/eng/milf2c1/\?voluumdata\=BASE64dmlkLi4wMDAwMDAwMy02MDdiLTRhM2EtODAwMC0wMDAwMDAwMDAwMDBfX3ZwaWQuLmM2ZmU3ODAwLTdjNmItMTFlNy04Yjg5LWRlOGQ4NGMxZmY1NV9fY2FpZC4uZjE5N2NhNzktMDQ1OC00YjM0LWE5NGEtZWM4YjZiYjIzOTVmX19ydC4uREpfX2xpZC4uNGFmZjg2NjgtNmM2OC00YmU1LTkzOWEtNDJlZGZhNmJhYmFmX19vaWQxLi41ODQ0MzZiZC1kMzE5LTRlZDgtYTEzNS00Y2VhOWRkYzZiOWRfX3ZhcjEuLjEyMzg0MjE4NTFfX3ZhcjIuLjM4X192YXIzLi42Zjk3NjhlYTMxMTFlNjk2NjQwMDI1OTBjNTdmOTZfX3ZhcjQuLjEwMDEyODc0ODFfX3ZhcjUuLlR1YmU4X192YXI2Li5UdWJlOCBQQyAtIFZpZGVvIEFfX3ZhcjcuLkdCX192YXI4Li5sQXFLV1FBQUFBQS1BQUFBT1ctdU8xdlIwRW5RVVFBQUpnQUFBRDRBQUFEXF9cXF9cXF9cXF9cXF9cQUFBQUFBPT1fX3ZhcjEwLi5GQlxfXERcX1xWQVxfXDMwMFxfXEFfX3JkLi5fX2FpZC4uX19hYi4uX19zaWQuLl9fY3JpLi5fX3B1Yi4uX19kaWQuLl9fZGl0Li5fX3BpZC4uX19pdC4uX192dC4uMTUwMjIxODkwMDk4MA\&adid\=1238421851\&SpotID\=38\&BanName\=6f9768ea3111e69664002590c57f96\&CampaignID\=1001287481\&SiteName\=T
<html class="no-js" xmlns="http://www.w3.org/1999/xhtml">
<!-- Mirrored from local-bitches.com/web/enlps/Int/rad/r2.html?voluumdata=BASE64dmlkLi4wMDAwMDAwNC00MjY5LTQzOGEtODAwMC0wMDAwMDAwMDAwMDBfX3ZwaWQuLmU4MzVmODAwLTY1MzItMTFlNi04MWFjLWZlYjJhNDE3YzZiYV9fY2FpZC4uNzI5ZWUxYzctNTk2Yy00ZTQ2LWFhODQtYTI1NjhkMTQ4YmExX19ydC4uUl9fbGlkLi4wMThiODkzNy0wODMzLTQ1ZmMtYTE2ZS1iMjhkZGExNDg4ZjVfX29pZDEuLjQ3YWJhZmI5LWFiZjctNDg1My05YzUyLTY0ZDQzNDZhZmI2Y19fdmFyMS4uT0NUMTUtMjYyX192YXIyLi57S2V5d29yZH1fX3ZhcjMuLlhoYW1zdGVyX192YXI0Li4xMDIwODMzNzQxX192YXI1Li4wXC5cMTkwX19yZC4uYWRzXC5cdHJhZmZpY2p1bmt5XC5cbmV0X19haWQuLl9fYWIuLl9fc2lkLi4&Ad=OCT15-262&Keyword={Keyword}&site=Xhamster&bidid=1020833741&bidv=0.190&aclid=fJ61VwAAAADZSRAAyeeqO4FY5UbpoAMAz0kQANlJEAD_____AAAAAA== by HTTrack Website Copier/3.x [XR&CO'2014], Thu, 18 Aug 2016 15:12:57 GMT -->
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--[if lt IE 7]>
<html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>
<html class="no-