Skip to content

Instantly share code, notes, and snippets.

View mhdalmajid's full-sized avatar
👋
Hey!

Mohammed Almajid mhdalmajid

👋
Hey!
View GitHub Profile
class Candidate {
name: string;
points: number;
constructor(name: string) {
this.name = name;
this.points = 0;
}
addPoints(points: number) {
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
@mhdalmajid
mhdalmajid / google_sheets_fill_values_down.js
Created November 10, 2022 00:05
fill down google sheet column
function fillValuesDown() {
var spreadsheet = SpreadsheetApp.getActive()
var currentRange = spreadsheet.getRange("A2:A" + spreadsheet.getLastRow())
var newRange = []
var newFillValue
currentRange.getValues().map(function(value) {
if (value[0] !== '') {
newFillValue = value[0]
newRange.push([newFillValue])
} else {
@mhdalmajid
mhdalmajid / arrayOfObjectsToCsv.ts
Last active November 11, 2022 02:15
convert json to csv
const convertObjectToCsv = (data: { [key: string]: any }[]) => {
/**
* specify how you want to handle null values here
* */
if (!Array.isArray(data) || !data.length) return []
const headers = Object.keys(data[0]).join(',')
const rows = data.map(item =>
Object.values(item)
@mhdalmajid
mhdalmajid / CmderZSH.md
Created May 4, 2020 11:51 — forked from dfontana/CmderZSH.md
My setup guide for installing Cgywin, Mintty, Cmder, and ZSH.

What's this?

Instructions to obtain ZSH on a windows environment, without the input funny business presented by some other attempted solutions.

The final result is ZSH running on a mintty terminal, emulated by cygwin, and being handled by the popular cmder.

Why is this here?

For the benefit of myself and others. I've already followed these instructions twice. It took me hours to figure all this out, maybe someone else can save a few.

What exactly is covered?

  • Installing and setting up cmder

MySQL Cheat Sheet

Help with SQL commands to interact with a MySQL database

MySQL Locations

  • Mac /usr/local/mysql/bin
  • Windows /Program Files/MySQL/MySQL version/bin
  • Xampp /xampp/mysql/bin

Add mysql to your PATH

@mhdalmajid
mhdalmajid / eslint_prettier_airbnb.md
Created July 20, 2019 14:26 — forked from bradtraversy/eslint_prettier_airbnb.md
ESLint, Prettier & Airbnb Setup

VSCode - ESLint, Prettier & Airbnb Setup

1. Install ESLint & Prettier extensions for VSCode

Optional - Set format on save and any global prettier options

2. Install Packages

npm i -D eslint prettier eslint-plugin-prettier eslint-config-prettier eslint-plugin-node eslint-config-node
{
"extends": [
"airbnb",
"plugin:prettier/recommended",
"prettier/react",
"react-app"
],
"parser": "babel-eslint",
"parserOptions": {
@mhdalmajid
mhdalmajid / sql-mongo_comparison.md
Created August 30, 2018 20:15 — forked from aponxi/sql-mongo_comparison.md
MongoDb Cheat Sheets

SQL to MongoDB Mapping Chart

SQL to MongoDB Mapping Chart

In addition to the charts that follow, you might want to consider the Frequently Asked Questions section for a selection of common questions about MongoDB.

Executables

The following table presents the MySQL/Oracle executables and the corresponding MongoDB executables.

<key name="Palette1" modified="2017-01-06 21:01:42" build="161206">
<value name="Name" type="string" data="One Dark"/>
<value name="ExtendColors" type="hex" data="00"/>
<value name="ExtendColorIdx" type="hex" data="0b"/>
<value name="TextColorIdx" type="hex" data="10"/>
<value name="BackColorIdx" type="hex" data="10"/>
<value name="PopTextColorIdx" type="hex" data="10"/>
<value name="PopBackColorIdx" type="hex" data="10"/>
<value name="ColorTable00" type="dword" data="00342c28"/>
<value name="ColorTable01" type="dword" data="0070635c"/>