Skip to content

Instantly share code, notes, and snippets.

View KubaJastrz's full-sized avatar

Kuba Jastrzębski KubaJastrz

View GitHub Profile
const array = ["foo", "bar", null, "zoo", null, undefined];
const filterdArray = array.filter(notEmpty);
function notEmpty<T>(value: T): value is Exclude<typeof value, null | undefined> {
return value !== null && value !== undefined;
}

My thoughts on mentoring

Mentoring is not a teaching job. It's about working together on a problem, so that the person can pick up your habits and tricks, learn new tools and develop their own workflow.

It's about providing a safe environment for juniors, so that they work and learn from their mistakes on a real job instead of synthethic courses.

It's about being available and answering all their questions. Asking questions reveals an attentive attitude for a junior, make sure they don't stop, even when it might feel tedious. Eventually they'll learn how to ask good questions. Put communication and conversation as your priority.

It's about doing code reviews, so you can see their skill level and guide them better. It's also useful for them to perform reviews on your code, so that they can have the opportuninty to recognize anything they don't understand and also get the feeling of contribution, even with (for now) limited knowledge. DON'T BE pendantic and picky in reviews, BE supportive and point to

@KubaJastrz
KubaJastrz / 01-example.ts
Last active October 22, 2021 13:14
Testing modules that use env variables in `jest`
const isDevelopment = process.env.NODE_ENV !== 'production'
export function log(...args) {
if (isDevelopment) {
console.log(...args)
}
}
export type Example = 'hello'
@KubaJastrz
KubaJastrz / git-reset-hard.sh
Created February 24, 2021 12:43
Useful scripts
#!/bin/sh
branch=$(git rev-parse --abbrev-ref HEAD)
remote="${1:-origin}"
# Wait for confirmation with Enter key
read -p "git reset --hard $remote/$branch " y
git fetch "$remote" "$branch"
git reset --hard "$remote"/"$branch"