Skip to content

Instantly share code, notes, and snippets.

Avatar
ℹ️

Marius Reimer reime005

ℹ️
View GitHub Profile
View scroll-indicator-3.jsx
<View
style={{
height: 100,
...
}}
>
<View
style={{
position: "absolute",
top: `${Number(scrollPerc || 0).toFixed(0)}%`,
View scroll-indicator-2.jsx
const scrollElementHeightPercent = 45;
export default Example = () => {
...
const [scrollViewHeight, setScrollViewHeight] = React.useState(0);
const scrollPerc = (contentOffset.y / (contentSize - scrollViewHeight))
* (100 - scrollElementHeightPercent);
return(
View scroll-indicator-1.jsx
export default Example = () => {
const [contentOffset, setContentOffset] = React.useState({ x: 0, y: 0 });
const [contentSize, setContentSize] = React.useState(0);
return(
<ScrollView
onScroll={e => {
setContentOffset(e.nativeEvent.contentOffset);
}}
onContentSizeChange={(_, height) => {
View android.wait-for-launcher.sh
#!/bin/bash
echo ""
echo "[Waiting for launcher to start]"
LAUNCHER_READY=
while [[ -z ${LAUNCHER_READY} ]]; do
UI_FOCUS=`adb shell dumpsys window windows 2>/dev/null | grep -i mCurrentFocus`
echo "(DEBUG) Current focus: ${UI_FOCUS}"
case $UI_FOCUS in
View App.lazy.js
import * as React from 'react';
const VeryBigJokesList = React.lazy(() => import('./VeryBigJokesList'));
function App() {
return (
<div className="App">
<header className="App-header">
<div style={{ maxWidth: 600 }}>
<React.Suspense fallback={<p>Loading list...</p>}>
View App.eager.js
import * as React from 'react';
import VeryBigJokesList from './VeryBigJokesList';
function App() {
return (
<div className="App">
<header className="App-header">
<div style={{ maxWidth: 600 }}>
<VeryBigJokesList />
View VeryBigJokesList.js
import React from 'react'
import preDefinedJokes from './preDefinedJokes.json'
const VeryBigJokesList = ({ jokes = preDefinedJokes }) => {
if (!Array.isArray(jokes)) {
return <p>No jokes found.</p>
}
return (
View mac-dev-folder-issues.sh
# fix vscode issue that causes a 100% cpu usage (tsserver)
~/Library/Caches/typescript
# ios / xcode
~/Library/Developer/Xcode/DerivedData/*
~/Library/Developer/CoreSimulator/Caches/*
# android
~/.gradle/caches
@reime005
reime005 / index.html
Last active Apr 26, 2020
CSS Custom Text Highlighting
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<link href="https://fonts.googleapis.com/css2?family=Baloo+Bhaina+2:wght@600&display=swap" rel="stylesheet">
<style type="text/css">
body {
font-family: 'Baloo Bhaina 2', cursive;
background-color: #fffdf8;
}
.highlighted-text {
@reime005
reime005 / README.md
Created Nov 24, 2019
Github Actions badge Example (.github/workflows/iOS.yml)