Skip to content

Instantly share code, notes, and snippets.

View haithamsha's full-sized avatar

Haitham AbdElRady haithamsha

  • ITS
  • Cairo, Egypt
View GitHub Profile
@haithamsha
haithamsha / myMashup.py
Last active August 23, 2019 21:02
Get restaurants info with name and meal type using google api's and foursquare api's
import httplib2
import json
import sys
import codecs
sys.stdout = codecs.getwriter('utf8')(sys.stdout)
sys.stderr = codecs.getwriter('utf8')(sys.stderr)
# gapi_key="your key"
@haithamsha
haithamsha / decimaltobinary.py
Created July 24, 2019 22:03
Convert decimal to binary with python, there is not the perfect solution trying to enhance it.
def decToBinary(n):
mod = ""
n = int(n)
while n>0:
result = int(n/2)
mod = str(mod) + str(n%2)
n = int(result)
return mod
@haithamsha
haithamsha / mario.c
Created July 23, 2019 16:15
Mario problem set 1 with c lang
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void makepyramid(int n);
char * printSpaces(int n);
int main()
{
@haithamsha
haithamsha / mario.js
Created July 22, 2019 02:00
Mairo problem solution with javascript
makePyramid(2);
function makePyramid(n) {
n = n *2+2;
r = parseInt(n/2) + 1;
for(var i=2;i<n;i+=2) {
// inject spaces before every hash line
// number of spaces r = n/2 + 1
var z = (n-i)/2+1;
process.stdout.write(returnSpaces(z));