Skip to content

Instantly share code, notes, and snippets.

View msalahz's full-sized avatar
🎯
Focusing

Mohammed Zaghloul msalahz

🎯
Focusing
View GitHub Profile
@msalahz
msalahz / .eslintignore
Created October 24, 2024 17:33 — forked from jonbeebe/.eslintignore
Recommended ESLint and Prettier config for React TypeScript
src/tests
node_modules
build
dist
dist-ssr
.vscode
public
*.test.js
*.test.jsx
*.test.ts
@msalahz
msalahz / Activate Office 2019 for macOS VoL.md
Created January 22, 2022 10:03 — forked from zthxxx/Activate Office 2019 for macOS VoL.md
crack activate office on mac with license file

Activate MS Office 2019/2016 for macOS - Microsoft_Office_2019_VL_Serializer

Office 2019 above

2019-06-03

Note that Office2019 DO NOT support activate via simple copy/paste plist license file which is the simplest way to activate Office 2016. Fortunately, you can also use the VL Serializer tool, just install Office 2019 and Serializer, then run Serializer to activate.

Ref

// .eslintrc.js
module.exports = {
parser: '@typescript-eslint/parser',
extends: [
'plugin:@typescript-eslint/recommended',
'prettier/@typescript-eslint',
'react-app',
'plugin:prettier/recommended',
],
@msalahz
msalahz / test.js
Created December 31, 2019 14:07
e2e test
/// <reference types="cypress" />
// constants
const TODO_ITEM_ONE = "Learn some Vue JS";
let TODO_ITEM_TWO = "Create tests with cypress.io";
let TODO_ITEM_THREE = "Apply applitools visual testing";
describe("Todo App Test Suite", () => {
// before each test, make sure to visit the home page of the app
beforeEach(() => {
@msalahz
msalahz / docker_kill.sh
Created April 26, 2019 11:04 — forked from evanscottgray/docker_kill.sh
kill all docker containers at once...
docker ps | awk {' print $1 '} | tail -n+2 > tmp.txt; for line in $(cat tmp.txt); do docker kill $line; done; rm tmp.txt

Installing SSHPASS

SSHPass is a tiny utility, which allows you to provide the ssh password without using the prompt. This will very helpful for scripting. SSHPass is not good to use in multi-user environment. If you use SSHPass on your development machine, it don't do anything evil.

Installing on Ubuntu

apt-get install sshpass

Installing on OS X

@msalahz
msalahz / batchPrettier.md
Created April 16, 2018 19:38 — forked from Mohamed3on/batchPrettier.md
Run prettier on all JS files in a directory
  1. Install prettier
  2. Make a .prettierignore file, and add directories you'd like prettier to not format, for example: **/node_modules
  3. Run prettier --write "**/*.js" *Don't forget the quotes.
  4. Optional: if you want to format JSON/SCSS files too, replace js with json/scss.
@msalahz
msalahz / GitHub-Desktop-Bitbucket.md
Created March 21, 2018 06:20 — forked from glueckpress/GitHub-Desktop-Bitbucket.md
[How-to] Use GitHub Desktop to clone and commit to a Bitbucket repository just as you would with any GitHub repository. (Mac)

Clone Bitbucket Repository and Add it to GitHub Desktop App (Mac)

You can’t clone a Bitbucket repo using GithHub Desktop directly. Instead you would have to:

  1. Clone the Bitbucket repo locally via command line.
  2. Add the cloned repository to your GitHub Desktop app.

After completing these 2 steps, you’ll be able to execute sync, push, pull, commit, and other git commands available in GitHub Desktop for your Bitbucket repository just as you would for any GitHub repository.

You will need your Bitbucket repository’s git URL as available on the Overview page of your repository:

var arr = ["a", "b", "c"];
var obj = {};
/* Method no: 1 */
arr.forEach(function(item, index) {
obj[index] = item;
});
@msalahz
msalahz / squirt.js
Created January 14, 2018 00:32 — forked from joelpt/squirt.js
Manually calculate the square root of a number with Javascript
// The Babylonian Method
// http://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method
// @param n - the number to compute the square root of
// @param g - the best guess so far (can omit from initial call)
function squirt(n, g) {
if (!g) {
// Take an initial guess at the square root
g = n / 2.0;
}
var d = n / g; // Divide our guess into the number