Skip to content

Instantly share code, notes, and snippets.

View YKalashnikov's full-sized avatar
:electron:
Life is Good 🥇

Iurii Kalashnikov YKalashnikov

:electron:
Life is Good 🥇
View GitHub Profile
type Store = {
name: string;
age: number;
hobbies: string[];
};
function createStore<T extends Record<string, any>>(initialStore: T) {
const store = initialStore;
return {
get<K extends keyof Store>(key: K) {
class LinkedList {
constructor() {
this.head = null
this.tail = null
}
append (data) {
const node = {data, next: null}
if(!this.head) {
this.head = node
}
import base64
import requests
image_path = 'YOUR_IMAGE_PATH'
secret_key = 'YOUR_SECRET_KEY'
with open(image_path, 'rb') as image_file:
img_base64 = base64.b64encode(image_file.read())
url = 'https://api.openalpr.com/v2/recognize_bytes'+'?recognize_vehicle=1&country=ru&secret_key={}'.format(secret_key)
import React from 'react';
import { View, Text, StyleSheet } from 'react-native';
import { MaterialCommunityIcons } from '@expo/vector-icons';
import PropTypes from 'prop-types';
import { weatherConditions } from '../utils/WeatherConditions';
const Weather = ({ weather, temperature }) => {
return (
<View
style={[
export const weatherConditions = {
Rain: {
color: '#005BEA',
title: 'Raining',
subtitle: 'Grab a cup of coffee',
icon: 'weather-rainy'
},
Clear: {
color: '#f7f033',
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import Weather from './components/weather'
import Constants from 'expo'
const KEY = Expo.Constants.manifest.extra.mysecret
export default class App extends React.Component {
state = {
import React from 'react';
import { View, Text, StyleSheet } from 'react-native';
import { MaterialCommunityIcons } from '@expo/vector-icons';
const Weather = () => {
return (
<View style={styles.weatherContainer}>
<View style={styles.headerContainer}>
<MaterialCommunityIcons size={48} name="weather-sunny" color={'#fff'} />
<Text style={styles.tempText}>Temperature˚</Text>
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
export default class App extends React.Component {
state = {
isLoading: true
};
render() {
const initialState = {
currentUser: {}
}
export default function reducer(state = initialState, action) {
switch (action.type) {
case 'LOGIN_USER':
return {...state, currentUser: action.payload}
case 'LOGOUT_USER':
return {...state, currentUser: {} }
export const logoutUser = () => ({
type: 'LOGOUT_USER'
})