Skip to content

Instantly share code, notes, and snippets.

View iegik's full-sized avatar
🏠
Working from home

Arturs Jansons iegik

🏠
Working from home
View GitHub Profile
@iegik
iegik / Stepper.js
Last active June 12, 2017 10:50
React Native Stepper component like described in https://material.io/guidelines/components/steppers.html
/**
* @flow
*/
import React from 'react';
import {
Image,
View,
} from 'react-native';
/**
* Autocomplete Input for Google Places API
* @flow
*/
import React, {Component} from 'react';
import { Input } from 'native-base';
import {get} from '../utils/request';
export default styles => Object.keys(styles)
.filter((key) => !/^_/.test(key))
.reduce((prev, next) => ({...prev, [next]:styles[next]}), {});
package com.app;
import android.content.Intent;
import android.net.Uri;
import android.provider.Settings;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import com.facebook.react.ReactActivity;
@iegik
iegik / FAQ.md
Last active May 7, 2025 08:11
React Native tips & tricks

State management

All of the state management libraries you mentioned have their unique features and advantages, and the choice of which one to use ultimately depends on the specific needs and requirements of your project. However, here's a brief overview of each library:

  1. MobX: MobX is a simple, lightweight, and easy-to-learn library for managing state in React applications. It has a reactive programming model and provides automatic state updates, which means you don't have to write complex code for updating your app's state. It also has good performance and works well with TypeScript.

  2. React Context: React Context is a built-in feature of React that allows you to share data between components without having to pass props down the component tree. It's a good choice for simple use cases where you need to share state between components without any complex logic.

  3. Redux: Redux is a widely-used library that provides a single source of truth for managing state in large-scale React applications. It has

@iegik
iegik / README.md
Last active September 2, 2022 12:41
Unencript

View info about PUBLIC KEY:

echo "..." | grep -v -- ----- | tr -d '\n' | base64 -d | openssl asn1parse -inform DER
@iegik
iegik / notwtf.md
Last active November 19, 2024 19:19
Not WTF
@iegik
iegik / CookieManager.js
Created May 4, 2017 17:32
merged react-native-cookies and react-native-cookiemanager
import React from 'react';
import { Platform } from 'react-native';
import { HOST } from '../../api/constants';
import { serialize, parse } from 'cookie';
import { reduce, map, forEach, filter } from 'lodash';
export function callback(err, res) {
return res;
}
@iegik
iegik / _define.js
Last active December 15, 2017 12:45
Assign value to the context by key path
/**
* Assign value to the context by key path
* @param {array} path ['foo', 'bar']
* @param {mixed} value
* @returns {*} result {foo:{bar: value}}
*/
function _define (path, value){
return path.reduce((x, y, i) => {
return x[y] = i === path.length - 1 && typeof value !== 'undefined' ? value : x[y] || {};
}, this)
@iegik
iegik / CODESTYLE.md
Last active June 10, 2024 13:11
Frontend tips and tricks

Code Style

Add "precommit" script into package.json

npx mrm lint-staged