Skip to content

Instantly share code, notes, and snippets.

View xiel's full-sized avatar
🖖

Felix Leupold xiel

🖖
View GitHub Profile
@xiel
xiel / .github-workflows-main.yml
Created March 31, 2021 22:03 — forked from edvinasbartkus/.github-workflows-main.yml
Github Action for React Native Detox
name: Detox
on: [push]
jobs:
build:
runs-on: macOS-latest
timeout-minutes: 15
env:
@xiel
xiel / dabblet.css
Created June 16, 2020 06:24
Untitled
background: linear-gradient(to right, #80cdec 29%, #c00f2d 126%, #c00f2d 126%);
@xiel
xiel / useScrollDirection.ts
Created January 30, 2020 11:12
useScrollDirection react hook
import { useEffect, useRef, useState } from 'react'
import { getDocumentScrollPos } from '../helpers/getDocumentScrollPos'
import isPassiveSupported from '../helpers/isPassiveSupported'
type AxisName = 'x' | 'y'
type ScrollDir = '' | 'positive' | 'negative'
interface ScrollDirState {
dir: ScrollDir
hitThreshold: boolean
isAtMin: boolean
@xiel
xiel / gestureProjection.ts
Created January 3, 2020 19:06
projection function, returning distance that is to be expected from a release velocity of a gesture (spring / animation)
const DECAY_FAST = 0.99
const DECAY_NORMAL = 0.998
const projection = (velocityPxMs: number) => (velocityPxMs * DECAY_FAST) / (1 - DECAY_FAST)
@xiel
xiel / vapor.1.gif
Last active October 30, 2019 15:36 — forked from mathdroid/vapor.1.gif
👀
vapor.1.gif
@xiel
xiel / index.html
Created September 3, 2019 19:36
JS Bin Touchpad pinch demo // source https://jsbin.com/wukevep
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Touchpad pinch demo" />
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
http://experimental.mural.ly/vnext-mural/sticky/200/webglbody {
-ms-scroll-rails: none;
}
@xiel
xiel / facebook-normalize-wheel.js
Created September 3, 2019 18:52 — forked from akella/facebook-normalize-wheel.js
Facebook attempt at normalizing wheel event
/**
* Copyright (c) 2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule normalizeWheel
* @typechecks
@xiel
xiel / conditional-types.ts
Last active March 2, 2019 16:52
Typescript | Conditional Types
/*
tyescript different sets of parameters OR function signature
*/
interface foo {
foo1: string
foo2: string
blubb: string
}
interface bar {
@xiel
xiel / gist:46d9e67edc93a6e470bf737802657a05
Created March 2, 2019 16:51
Typescript | Conditional Types
interface foo {
foo1: string
foo2: string
blubb: string
}
interface bar {
bar1: number
bar2: number
blubb: number
@xiel
xiel / optionalChain.ts
Last active July 8, 2019 11:14
Optional Chaning in Typescript
/**
* Optional Chaining in Typescript
* lets you safely access nested properties, while preserving type information
*
* Usage:
* type TData = { foo: Optional<{ bar: Optional<number> }> }
* const data: TData = { foo: undefined }
* const num = optionalChain(() => data.foo!.bar)
*/
type Optional<T> = T | undefined