Skip to content

Instantly share code, notes, and snippets.

View iegik's full-sized avatar
🧾
Looking for work

Arturs Jansons iegik

🧾
Looking for work
View GitHub Profile
@iegik
iegik / ddata-api.js
Last active June 11, 2018 21:47
Place Predictions Interface
const DDATA_API_KEY = 'YOUR_API_KEY';
const ddataAPI = body => {
return new Promise((response, reject) => {
let xhr = new XMLHttpRequest();
xhr.open("POST", "https://suggestions.dadata.ru/suggestions/api/4_1/rs/suggest/address?5");
xhr.setRequestHeader("Accept", "application/json");
xhr.setRequestHeader("Authorization", `Token ${DDATA_API_KEY}`);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.onreadystatechange = () => {

Multiples of 3 and 5

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Find the sum of all the multiples of 3 or 5 below 1000.

answer
@iegik
iegik / schema.js
Last active January 27, 2021 07:41
Generates schema of GraphQL for http://example.com/graphql
import fetch from 'node-fetch';
import jsonfile from 'jsonfile';
const GQL = (query, variables) => ({query, variables})
const request = (...args) => {
try {
return fetch(...args)
} catch (e) {
return Promise.reject({errors:[e]});
@iegik
iegik / VECTOR_GRAPHICS.md
Last active January 30, 2022 17:45
SVG sprites, tools and more
@iegik
iegik / ADB.md
Last active February 8, 2026 10:42
Android

ADB

connect via TCP/IP

adb -s <device_name> tcpip 5555

shell

@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