Skip to content

Instantly share code, notes, and snippets.


Przemek Sobstel sobstel

View GitHub Profile
sobstel / autofill.ts
Last active Sep 30, 2022
React: handle browser-autofilled password in Chrome
View autofill.ts
// Problem: when remembered, Chrome auto-fills the password input, but in fact it doesn't
// set the value and doesn't fire onChange event until there's any kind of interaction.
// If password value is empty, then submit button is still disabled yet password looks filled,
// which looks bad. See:
const [isAutofilled, setIsAutofilled] = useState(false);
const passwordElRef = useRef<HTMLInputElement | null>(null);
useEffect(() => {
const element = passwordElRef.current;
sobstel /
Last active Sep 30, 2022
Shape Up: Write the Pitch


The raw idea, a use case, or something we’ve seen that motivates us to work on this


How much time we want to spend and how that constrains the solution


sobstel / CODE_delorean_clock.ino
Last active Nov 16, 2021
CODE_delorean_clock_V4_SUMMER.ino [UPDATED]
View CODE_delorean_clock.ino
#include "SevenSegmentTM1637.h"
#include "SevenSegmentExtended.h"
#include "RTClib.h"
// Sortie horloge Rouge
const byte PIN_CLK_Red = A0; // define CLK pin
// Sortie horloge Verte
const byte PIN_CLK_Green = A1; // define CLK pin
// Sortie horloge Orange
const byte PIN_CLK_Orange = A2; // define CLK pin
View mapDuplicates.test.ts
import mapDuplicates from "./mapDuplicates";
describe("mapDuplicates", () => {
it("addresses duplicate surnames", () => {
const surnames = ["González", "González", "Martínez", "González"];
mapDuplicates(surnames, (name, index) => `${name} ${index}`)
).toEqual(["González 0", "González 1", "Martínez", "González 3"]);
sobstel / unmount_animation_example.js
Created Mar 8, 2021
react-native-animatable unmount animation with hooks
View unmount_animation_example.js
const MyComponent = (props) => {
const ref = React.useRef();
React.useEffect(() => {
return () => ref?.current?.fadeOut(); // as you know, this is the same as unmount ;)
}, []); // track some prop that changes
sobstel / deploy.yml
Created Oct 1, 2020
Deploy Ruby AWS lambda with github action
View deploy.yml
- "master"
runs-on: ubuntu-latest
- uses: actions/checkout@v2
sobstel / win10vm_apple_keyboard.txt
Last active Nov 2, 2020
View win10vm_apple_keyboard.txt
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetScrollLockState, AlwaysOff
;following section remaps alt-arrow and command-arrow
;keys to mimic OSX behaviour
#Up::SendInput {Lctrl down}{Home}{Lctrl up}
sobstel /
Last active May 7, 2020
Google page speed report 2018

Google page speed report 2018

  • Time spent on mobile vs desktop 
    • 2015 -> Google started getting more search queries from mobile than desktop
    • 2018 -> Time spent on mobile 2-3x bigger than on desktop (and growing...)
  • Users reaction
    • 46% dislike waiting for slow pages to load 
    • 53% abandon a site that loads in more than 3 seconds
  • As of July 2018, page speed will become an important ranking factor for mobile searches 
  • Page speed will also influence ad rank and the CPC that you pay 
sobstel / createSequentialNavigator.js
Created Apr 29, 2020
React Navigation (v4) sequential navigator
View createSequentialNavigator.js
// @flow
import React, { Component } from 'react';
import _ from 'lodash';
import createStackNavigator from './createStackNavigator';
type Props = {
navigation: *,
sobstel / typescript-cheatsheet.ts
Last active Oct 11, 2019
TypeScript cheatsheet
View typescript-cheatsheet.ts
// same arg type and return type
withUID<T>(obj: T)
// "extends" helps providing some constraints
// eg <T extends object>
withUID({a: 1}) // valid
withUID("wrong way") // NOT valid
// default value type (string)
A<T=string> { name: T }