Skip to content

Instantly share code, notes, and snippets.


Przemek Sobstel sobstel

View GitHub Profile
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 }
sobstel / router.rb
Last active Nov 13, 2019
Simple Ruby router
View router.rb
class Router
Route =, :block)
class RouteSet
def on(pattern, &block)
Router.routes.push, block)
@routes = []
sobstel / no_simulator.txt
Last active Jul 12, 2019
React Native "Could not find iPhone simulator"
View no_simulator.txt
❯ react-native run-ios --simulator="iPhone 7"
Found Xcode workspace Nabobil.xcworkspace
Could not find iPhone 7 simulator
Error: Could not find iPhone 7 simulator
at resolve (...)
sed -i '' 's/startsWith/includes/g' node_modules/react-native/local-cli/runIOS/findMatchingSimulator.js
sobstel /
Last active Dec 15, 2018
10 ways to have a better conversation (by Celeste Headlee)

10 ways to have a better conversation (by Celeste Headlee)

  1. Don't multitask (be present, be in that moment)
  2. Don't pontificate
  3. Use open-ended questions
  4. Go with the flow
  5. If you don't know, say that you don't know
  6. Don't equate your experience with theirs (it's never the same, all experiences are individual)
  7. Try not to repeat yourself
  8. Stay out of the weeds (people don't care about details)