Skip to content

Instantly share code, notes, and snippets.

View sturmenta's full-sized avatar
🌌

Nicolas Sturm sturmenta

🌌
  • Argentina
  • 12:34 (UTC -03:00)
View GitHub Profile
@sturmenta
sturmenta / exampleOfUse.js
Created October 16, 2019 21:54
react-native ask permissions
requestLocationPermission({
grantPermission: () => console.warn('location granted'),
refusePermission: () => console.warn('location not granted'),
});
@sturmenta
sturmenta / keybase.md
Created November 14, 2019 13:47
keybase.md

Keybase proof

I hereby claim:

  • I am sturmenta on github.
  • I am sturmenta (https://keybase.io/sturmenta) on keybase.
  • I have a public key ASCDQDUVsCMsapvOT9Dv2-9VnH4Hnoxx1SQvIPJ2zPtu9go

To claim this, I am signing this object:

@sturmenta
sturmenta / Table.tsx
Last active June 24, 2022 23:51
simple react table
import React from 'react'
import { ClassNames, CSSObject } from '@emotion/react'
import { Column, useTable } from 'react-table'
import TextByScale from './TextByScale'
interface Props {
columns: Array<Column>
data: Array<any>
}
@sturmenta
sturmenta / GetContainerDimensions.js
Last active February 22, 2024 19:49
react get div dimensions - using react hooks
import { useState, useEffect } from 'react';
const useContainerDimensions = containerRef => {
const getDimensions = () => ({
width: containerRef.offsetWidth,
height: containerRef.offsetHeight
});
const [dimensions, setDimensions] = useState({ width: 0, height: 0 });
@sturmenta
sturmenta / mac-config.md
Last active August 31, 2023 21:53
mac m1- start configuration
defaults write com.apple.dock autohide-delay -float 0; defaults write com.apple.dock autohide-time-modifier -int 0;killall Dock
  • show hide folders & files
@sturmenta
sturmenta / getCUIT.js
Last active June 6, 2022 12:09
codigo generador de CUIT javascript - CUIT generator
/**
* Given a DNI and a gender it returns the corresponding CUIT.
* @param {String} dni
* @param {String} gender
*/
const getCUIT = (dni, gender = 'M') => {
if (!dni || dni.length !== 8) {
throw new Error('The DNI number must contain 8 numbers');
}
@sturmenta
sturmenta / cloudSettings
Last active November 1, 2023 19:55
vscode config
{"lastUpload":"2020-06-17T23:02:23.799Z","extensionVersion":"v3.4.3"}
@sturmenta
sturmenta / getStatusBarHeight.ts
Created October 22, 2020 19:41
react native - get status bar height
import {Dimensions, Platform, StatusBar} from 'react-native';
const {width, height} = Dimensions.get('window');
const X_WIDTH = 375;
const X_HEIGHT = 812;
const XSMAX_WIDTH = 414;
const XSMAX_HEIGHT = 896;
@sturmenta
sturmenta / getFontScale.ts
Created October 23, 2020 03:32
react native - get font scale
import {PixelRatio, Platform} from 'react-native';
type fontScales = -3 | -2 | -1 | 0 | 1 | 2 | 3;
type iOS_fontScales = '0.823' | '0.882' | '0.941' | '1' | '1.118' | '1.235' | '1.353';
type iOS_fontScalesMap<T> = {[scale in iOS_fontScales]: T};
const fontScale_iOS: iOS_fontScalesMap<number> = {
'0.823': -3,
'0.882': -2,
'0.941': -1,
@sturmenta
sturmenta / KeyboardListener.ts
Created April 6, 2021 17:27
react-native KeyboardListener
import React, {useEffect} from 'react';
import {Keyboard} from 'react-native';
const KeyboardListener: React.FC<{
onDidShow: (e: any) => void;
onDidHide: (e: any) => void;
}> = ({onDidShow, onDidHide}) => {
useEffect(() => {
if (onDidShow) Keyboard.addListener('keyboardDidShow', onDidShow);
if (onDidHide) Keyboard.addListener('keyboardDidHide', onDidHide);