Skip to content

Instantly share code, notes, and snippets.

View elmarzouki's full-sized avatar
:shipit:
Solving..

Mostafa El-Marzouki elmarzouki

:shipit:
Solving..
View GitHub Profile
@elmarzouki
elmarzouki / reverse.js
Last active August 31, 2020 18:31
reverse the word order of a sentence without removing any spaces
const str = ' Mary had a little lamb. ';
function reverseSentence(str) {
var tmp = "";
var reversed = [];
for (i = 0; i < str.length; i++) {
if (str[i] == " ") {
tmp += str[i]
}
if (str[i] == " " && str[i + 1] != " " || i + 1 == str.length) {
@elmarzouki
elmarzouki / .zshrc
Last active September 2, 2025 09:48
zsh config file for shell and python
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""This module's docstring summary line.
This is a multi-line docstring. Paragraphs are separated with blank lines.
Lines conform to 79-column limit.
Module and packages names should be short, lower_case_with_underscores.
Notice that this in not PEP8-cheatsheet.py
@elmarzouki
elmarzouki / format.py
Created February 6, 2018 17:28
simple example for using .formate in python
# 10 * 10 multiplication table
for i in range(1, 11):
print('{:<3}|'.format(i), end='')
for j in range(1, 11):
print('{:>4}|'.format(i * j), end='')
if i == 1:
print('\n{:-^53}|'.format(''), end='')