Skip to content

Instantly share code, notes, and snippets.

View manuelbieh's full-sized avatar
⚛️
Available for hire! Berlin. React.

Manuel Bieh manuelbieh

⚛️
Available for hire! Berlin. React.
View GitHub Profile
import React, { useCallback, useRef } from 'react';
import {
Button,
SafeAreaView,
ScrollView,
StatusBar,
View,
} from 'react-native';
import CameraRoll from '@react-native-community/cameraroll';
@manuelbieh
manuelbieh / README.md
Last active August 26, 2022 14:51
Deno File Download

Use Deno to download files from the internet.

Usage

deno run --allow-net --allow-write download.ts [url] [filename]

Example

Keybase proof

I hereby claim:

  • I am manuelbieh on github.
  • I am manuelbieh (https://keybase.io/manuelbieh) on keybase.
  • I have a public key ASCOauR6B5_RIn6S1TP_uVc6eOM3DbJ-1aFXWa9f6z69qAo

To claim this, I am signing this object:

const removeEmoji = (str) => str.replace(
/([\uE000-\uF8FF]|\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDDFF])|\ud83c[\udde6-\uddff]\ud83c[\udde6-\uddff]|\xF0\x9F\xA6\x84/g,
''
)
.replace(/\xF0|\x9F|\x98|\x8D|\xF0|\x9F/g, '');
dirUp1() { cd ../"$1"; }
dirUp2() { cd ../../"$1"; }
dirUp3() { cd ../../../"$1"; }
dirUp4() { cd ../../../../"$1"; }
dirUp5() { cd ../../../../../"$1"; }
dirUp6() { cd ../../../../../../"$1"; }
alias ..=dirUp1
alias ...=dirUp2
alias ....=dirUp3
import axios from 'axios';
import applyConverters from 'axios-case-converter';
import { objectKeysToCamelCase } from 'utils';
export const redirectToLogin = () => {
window.location.href = process.env.AUTH_URL;
};
export const getAccessToken = () =>
(JSON.parse(window.localStorage.getItem('auth')) || {}).accessToken;
const glob = require('glob');
const fs = require('fs');
const files = glob.sync(process.cwd() + '/{src,config,scripts}/**/*.{js,jsx,ts,tsx}', {nodir: true});
const letterCount = files
.map((file) => fs.readFileSync(file, { encoding: 'utf-8'}))
.map((fileContent) => fileContent.split(''))
.reduce((acc, lettersOfFile) => {
lettersOfFile.forEach((letter) => {
acc[letter] = acc[letter] ? acc[letter]+1 : 1;
onChange = (e: React.ChangeEvent) => {
e.persist();
const {
target: { checked, name, type, value },
} = e;
if (!name && process.env.NODE_ENV === 'development') {
console.warn(
`Change event with value '${value}' happened for an element without name prop. This is probably by mistake.`
);
@manuelbieh
manuelbieh / actions.js
Created June 18, 2018 11:39
request/success/failure
// @flow
import type { Dispatch } from 'redux';
import { ClientRequest } from 'services/api';
import { getTeamId } from 'store/team/selectors';
import isClient from 'shared/utils/isClient';
export const ActionTypes = {
ACCESS_TOKEN_REQUEST: 'auth/access-token/request',
ACCESS_TOKEN_SUCCESS: 'auth/access-token/success',
ACCESS_TOKEN_FAILURE: 'auth/access-token/failure',