Skip to content

Instantly share code, notes, and snippets.

View tk-o's full-sized avatar

Tomasz Kopacki tk-o

View GitHub Profile
@tk-o
tk-o / force-reload.js
Last active August 31, 2022 05:47
Programmatic location force reload — [live demo](https://codesandbox.io/s/programmatic-location-force-reload-0ol5gd)
const ATTR_FORCE_RELOAD = "forceReload";
export function cleanUpFroceReloadSideEffects() {
const nextUrl = new URL(window.location.href);
nextUrl.searchParams.delete(ATTR_FORCE_RELOAD);
console.log(nextUrl);
window.history.replaceState(null, null, nextUrl);
@tk-o
tk-o / tko-cv.md
Last active August 30, 2022 03:31
Curriculum Vitae for Tomasz Kopacki

Tomasz Kopacki

Summary

My ways

I'm a business-oriented principal software engineer who can:

  • guide the approach and execution of a software delivery team (serve as a Tech Lead);

  • be responsible for the direction, quality and approach, while combining in-depth knowledge of technical constraints, user needs, and organizational level leadership (serve as an Architect);

  • dig deep into arbitrarily complex problems and find an appropriate path forward (serve as a Solver);

@tk-o
tk-o / Dockerfile
Last active April 7, 2021 04:58
A working demo of a custom Substrate node, based on node-template: using Docker, Docker Compose
FROM paritytech/ci-linux:production as builder
LABEL description="This is the build stage for Jack Block. Here we create the binary."
ARG PROFILE=release
WORKDIR /substrate
COPY . /substrate
RUN cargo build --$PROFILE
@tk-o
tk-o / all-to-start-with.md
Last active December 15, 2019 11:01
Sketchnoting cheatsheet

Sketchnoting

What is it?

I was reading various resources and came up with the following definition:

Sketchnoting is form of making notes and incorporating visuals into the text (or text into the visuals).

What it helps with?

Long story short: the reader's brain can digest a given piece of information more easily.

People are in general (at least in 65%) visual learners. They pay attention to graphical content and are able to remember pictures extremely well. You probably heard this quote:

@tk-o
tk-o / supports position: sticky in javascript.js
Last active December 15, 2019 09:32
supports position: sticky in javascript #learninpublic
// es-5 compatible
function supportsPositionSticky() {
var element = document.createElement('div');
return ['', '-o-', '-webkit-', '-moz-', '-ms-'].filter(function(prefix) {
element.style.position = prefix + 'sticky';
return element.style.position === 'sticky';
}).length !== 0;
}
// es-next compatible
@tk-o
tk-o / cypress-integration-redirects.spec.js
Last active July 5, 2018 05:54
Testing external redirects in Cypress.io
it('should go to external page after clicking on CTA button', () => { // it's not click per se - we use element's href attribute
cy.get('a[href*="redirect"]') //finds all redirect links
.each(($linkElement) => {
const internalUrl = $linkElement.attr('href');
cy.log(`Checking redirect for ${internalUrl}`);
cy.getExternalRedirect(internalUrl) // gets 302 redirect
.as('externalRedirect'); // saves the request as alias for the assertions
@tk-o
tk-o / airplanes.js
Last active January 6, 2017 15:26
Javascript composition example
const Airplane = {
getName() {
return `${this.name}`
}
}
const AirbusA380 = {
name: 'Airbus A380',
getName() {
return `${Airplane.getName.call(this)} of ${this.airline}`
@tk-o
tk-o / Comparison.md
Last active December 7, 2016 20:52
C# Selenium vs. JavaScript
C# Selnium JavaScript (in Chrome Dev Tools)
driver document
driver.FindElement(By.Id("someId")) document.getElementById("someId")
driver.FindElements(By.ClassName("someClassName")) document.getElementsByClassName("someClassName")
driver.FindElement(By.CssSlector("#some-id .some-css-class tag")) document.querySelector("#some-id .some-css-class tag")
driver.FindElements(By.CssSlector("#some-id .some-css-class tag")) document.querySelectorAll("#some-id .some-css-class tag")
driver.FindElements(By.XPath("//*[@id='categories-menu']/li")) $x("//*[@id='categories-menu']/li")
@tk-o
tk-o / gist:5e9676d3cb54c43d6a059b6ef47e7719
Last active September 4, 2016 11:34
return true to win
id (2): !0
reflexive (3): NaN
transitive (9): '0',!1,''
counter (13): (x=0)=>y=>++x
peano (7): 2**53-1