Skip to content

Instantly share code, notes, and snippets.

View kosciolek's full-sized avatar

kosciolek

  • Poland - Małopolskie
View GitHub Profile
@kosciolek
kosciolek / styled.ts
Last active July 19, 2021 13:06
Styled components variant and iif.
export const iif = <PROPS extends unknown, PROP_NAME extends keyof PROPS>(
prop: PROP_NAME,
val?: PROPS[PROP_NAME]
) => (propsInner: PROPS) => {
if (val !== undefined) return propsInner[prop] === val ? "&" : "&.__NEVER";
return propsInner[prop] ? "&" : "&.__NEVER";
};
export const variant = <PROPS extends unknown>(
prop: PROPS[keyof PROPS],
@kosciolek
kosciolek / Grid.tsx
Created July 25, 2021 13:25
responsive grid
import { css } from "@emotion/react";
import styled from "@emotion/styled";
export const breakpoints = {
xs: 0,
sm: 460,
md: 820,
lg: 1350,
xl: 1880,
};
@kosciolek
kosciolek / index.js
Last active August 11, 2021 21:52
Facebook, scrape conversation messages
;(async () => {
console.info('Type stop() to stop.')
const sleep = (ms) => new Promise((res) => setTimeout(res, ms));
const msgSelector = ".j83agx80.jwdofwj8.pby63qed";
const msgTextSelector = ".oo9gr5id[dir=auto]";
const msgAuthorSelector = ".pfnyh3mw.r9r71o1u.m9osqain.fsrhnwul.dkr8dfph";
const scrollableSelector =
".buofh1pr.j83agx80.eg9m0zos.ni8dbmo4.cbu4d94t.gok29vw1";
const msgContainerSelector = '[aria-label=Messages]';
@kosciolek
kosciolek / asd.java
Created December 17, 2021 12:07
some uni homework project
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
import java.util.Stack;
// Troche pozmienialem nazwy metod/interfejsow ale poza tym to struktura prawie taka sama
// Dziala troche jak reverse polish notation (op popuje argumenty ze stacku i wrzuca result na stack)
class Main {
[
{
"name": "Erik",
"surname": "Perez",
"address": {
"country": "BJ",
"city": "Gekavenu",
"street": "Icni Square"
},
"birth": "1970-08-27T08:41:30.587Z",