Skip to content

Instantly share code, notes, and snippets.

View sturmenta's full-sized avatar
🌌

Nicolas Sturm sturmenta

🌌
  • Argentina
View GitHub Profile
@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 / cloudSettings
Last active November 1, 2023 19:55
vscode config
{"lastUpload":"2020-06-17T23:02:23.799Z","extensionVersion":"v3.4.3"}
@sturmenta
sturmenta / getCUIT.js
Last active June 5, 2025 14:10
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 / mac-config.md
Last active March 19, 2025 11:31
mac m1- start configuration
@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 / 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 / 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 / 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 / dist2GPS.ts
Last active June 16, 2023 23:29
Distance between two gps locations
const numToRad = (num) => (num * Math.PI) / 180;
export const getDistFrom2GpsLocations = ({ lat1, long1, lat2, long2 }) => {
lat1 = parseFloat(lat1);
long1 = parseFloat(long1);
lat2 = parseFloat(lat2);
long2 = parseFloat(long2);
const R = 6371e3;
const φ1 = numToRad(lat1);
@sturmenta
sturmenta / App.js
Last active September 11, 2019 03:08
react native KeyboardContext
import React, { PureComponent } from 'react';
import { AppNavigator, setTopLevelNavigator } from './navigation';
import { KeyboardProvider } from './utils/keyboardContext';
export default class App extends PureComponent {
render() {
return (
<KeyboardProvider>
<AppNavigator ref={navigationRef => setTopLevelNavigator(navigationRef)} />