Skip to content

Instantly share code, notes, and snippets.

View IslamWahid's full-sized avatar

Islam Salem IslamWahid

  • Berlin, Germany
View GitHub Profile
@IslamWahid
IslamWahid / T212_Transactions_importer.js
Last active April 21, 2022 02:03
import Trading212 contract note statements to a google sheet using Apps script
// reference: https://community.trading212.com/t/t212-contract-note-email-importer/15954/28
const config = {
sheetName: 'Transactions',
label: 'Trading212/Contract-Statements',
mapTransactions: true,
};
const headerRow = [
'Instrument',
@IslamWahid
IslamWahid / Helpful Git Commands
Last active February 26, 2023 11:58
Helpful Git Commands
Git Reflog
https://www.atlassian.com/git/tutorials/rewriting-history/git-reflog
https://git-scm.com/docs/git-reflog
```bash
git reflog show HEAD
git reset --hard HEAD@{x}
@IslamWahid
IslamWahid / SE_Top_Books.md
Last active January 7, 2022 16:48
Software Engineering Top Books List
@IslamWahid
IslamWahid / pg_dump_restore
Created January 3, 2022 08:52
Postgres Migration CheatSheet
pg_dump -h {HOST} -U {USER} -W --verbose -Fc --no-acl {DB_NAME} > ./{FILE_NAME}.psql
pg_restore -h {HOST} -U {USER} -W --exit-on-error --verbose --no-acl --dbname={DB_NAME} < ./{FILE_NAME}
@IslamWahid
IslamWahid / clear_dynamo_table.sh
Last active June 5, 2020 16:59
clear all items in a dynamo db table
#!/usr/bin/env zsh
local PARTITION_KEY='hashKey'
local SORT_KEY='sortKey'
local TABLE_NAME='table'
aws dynamodb scan \
--attributes-to-get $PARTITION_KEY $SORT_KEY \
--table-name $TABLE_NAME --query "Items[*]" |
jq --compact-output '.[]' |
@IslamWahid
IslamWahid / typeorm_tricks.md
Created January 28, 2020 13:38
TypeORM tricks

TypeORM tricks

Finding entity with with relation condition

There's a workaround for filtering based on relation fields for findOne()/find() methods that I've discovered recently. The problem with filtering related table fields only exists for ObjectLiteral-style where, while string conditions work perfectly.

Assume that we have two entities – User and Role, user belongs to one role, role has many users:

@Entity()
@IslamWahid
IslamWahid / jest_advanced_cheat_sheet.md
Last active February 6, 2023 00:32
jest advanced cheat sheet

Jest Advanced Cheat Sheet

mock specific ES6 class function

Use jest.spyOn to mock a class function for only a specific test case without affecting the other cases

import ExampleClass from 'ExampleClass';

it('should ', () => {
  jest
@IslamWahid
IslamWahid / iterm2-solarized.md
Created August 12, 2019 21:19 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@IslamWahid
IslamWahid / launch.json
Last active April 18, 2018 10:58
vscode debugging NodeJs launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "test Program",
"port": 5858,
"program": "${workspaceRoot}/index.js",
"env": {