Skip to content

Instantly share code, notes, and snippets.

View elmahdim's full-sized avatar

Mahmoud elmahdim

View GitHub Profile
@elmahdim
elmahdim / README.md
Last active May 26, 2022 19:55
Initial settings for linux VPS hosting

Update and upgrade apt packages

  • Before going any further, update & upgrade apt (advanced package tool) packages
# 👉 remote terminal

apt update && apt upgrade
@elmahdim
elmahdim / console-style.js
Created October 2, 2021 19:47
Customised console methods
// Styles
const consoleGroupLabelColor = "color: grey;";
const consoleGroupTitleColor = "color: black;";
const red = [
"background-color: #ffebe9;",
"color: #82071e;",
"font-weight: bold;",
];
/**
* @param {string} s
* @return {number}
*/
const romanToInt = s => {
const chart = {
I: 1,
V: 5,
X: 10,
L: 50,
@elmahdim
elmahdim / Python3_Cheatsheet.md
Last active December 14, 2017 13:59
Python 3 Cheatsheet

Identifiers

A Python identifier is a name used to identify a variable, function, class, module or other object. Python does not allow punctuation characters such as @, $, and % within identifiers. Python is a case sensitive programming language.

Naming conventions

  • Class names start with an uppercase letter. All other identifiers start with a lowercase letter.
  • Starting an identifier with a single leading underscore indicates that the identifier is private.
@elmahdim
elmahdim / EventsModule.js
Last active March 21, 2017 11:11
Events module
var EventsModule = {
initialize:function(b) {
this._eventHandler(b);
},
_eventHandler:function(b) {
Object.keys(b.events).forEach(function(a) {
var c = a.substr(0, a.indexOf(" ")), e = a.substr(a.indexOf(" ") + 1);
a = b.events[a];
c = document.querySelectorAll(c);
if (c.length && "function" == typeof b[a] && b.hasOwnProperty(a) && e) {
@elmahdim
elmahdim / gitgit.md
Last active December 15, 2016 08:15
Useful git commands

git show --name-only

commit b1e64c630129b47cb0ff1fcbed8b7cee10857000
Merge: 0fbfdab 8bb6266
Author: x_x <x@email.com>
Date:   Thu Nov 24 17:20:31 2016 +0300

    fix conflict

module/Admin/view/layout/admin.phtml
@elmahdim
elmahdim / .bashrc
Last active October 13, 2016 12:02
alias git commands
# subl ~/.bashrc
# git
alias glog='git log --all --decorate --oneline --graph --abbrev-commit'
@elmahdim
elmahdim / sublime-text
Last active October 14, 2016 08:16
Essential Sublime Text Plugins & Themes
# Plugins
https://packagecontrol.io/packages/AutoFileName
https://packagecontrol.io/packages/Case%20Conversion
https://packagecontrol.io/packages/Console%20Wrap%20for%20js
https://packagecontrol.io/packages/AdvancedNewFile
https://packagecontrol.io/packages/Local%20History
https://packagecontrol.io/packages/SideBarEnhancements
https://packagecontrol.io/packages/SwapStrings
https://packagecontrol.io/packages/All%20Autocomplete
imdone-atom
rest-client
highlight-selected
file-icons
atom-jade
emmet
linter
linter-eslint
terminal-plus
@elmahdim
elmahdim / _iteration.scss
Created August 9, 2016 08:56
Sass iteration
$colors-pallette: (#5856d6, #008aff, #34aadc, #ff2d55);
.wrapper {
@for $i from 1 through length($colors-pallette) {
&:nth-child(#{length($colors-pallette)}n+#{$i}) {
.item {
background-color: nth($colors-pallette, $i);
}
}
}