Skip to content

Instantly share code, notes, and snippets.

Avatar
🌌

Nicolas Sturm sturmenta

🌌
View GitHub Profile
View formatBigNumber.js
const values = [
{ K: 1000 },
{ M: 1000000 },
{ B: 1000000000 },
{ Qd: 1000000000000 },
{ Qt: 1000000000000000 },
{ St: 1000000000000000000 },
{ Sp: 1000000000000000000000 },
{ O: 1000000000000000000000000 },
{ N: 1000000000000000000000000000 },
@sturmenta
sturmenta / DottedLine.js
Last active Aug 29, 2019
react native - android - dotted line
View DottedLine.js
import React from 'react';
import { View, Text, StyleSheet } from 'react-native';
const styles = StyleSheet.create({
container: {
width: '100%',
alignItems: 'center',
height: 1,
marginBottom: 10,
marginTop: 10,
@sturmenta
sturmenta / dimensions.js
Last active Sep 9, 2019
JS Media Queries for Desktop, Tablet, Mobile.
View dimensions.js
const w = window.innerWidth;
export const isPhone = w >= 320 && w < 480;
export const isTablet = w >= 480 && w < 768;
export const isLargeTablet = w >= 768 && w < 1024;
export const isDesktop = w >= 1024 && w < 1280;
export const isLargeDesktop = w >= 1280;
@sturmenta
sturmenta / App.js
Last active Sep 11, 2019
react native KeyboardContext
View App.js
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)} />
@sturmenta
sturmenta / dist2GPS.js
Last active Oct 4, 2019
Distance between two gps locations
View dist2GPS.js
const dist2GPS = (lat1, lng1, lat2, lng2) => {
lat1 = parseFloat(lat1);
lng1 = parseFloat(lng1);
lat2 = parseFloat(lat2);
lng2 = parseFloat(lng2);
const R = 6371e3;
const φ1 = lat1.toRad();
const φ2 = lat2.toRad();
const Δφ = (lat2 - lat1).toRad();
@sturmenta
sturmenta / exampleOfUse.js
Created Oct 16, 2019
react-native ask permissions
View exampleOfUse.js
requestLocationPermission({
grantPermission: () => console.warn('location granted'),
refusePermission: () => console.warn('location not granted'),
});
View 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:

View cloudSettings
{"lastUpload":"2020-06-17T23:02:23.799Z","extensionVersion":"v3.4.3"}
View javascript.json
{
"Console.log": {
"prefix": "clg",
"body": ["console.log(`$1`, $1)"],
"description": "console.log"
}
}
@sturmenta
sturmenta / getStatusBarHeight.ts
Created Oct 22, 2020
react native - get status bar height
View getStatusBarHeight.ts
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;