Skip to content

Instantly share code, notes, and snippets.

View aturan23's full-sized avatar

Assylkhan Turan aturan23

  • Software developer
  • Kazakhstan, Almaty
View GitHub Profile
@aturan23
aturan23 / UserDefaultsStorage.swift
Created October 20, 2020 01:44
User defaults wrapper
typealias Key = String
protocol StorageProtocol {
func integer(for key: Key) -> Int
func bool(for key: Key) -> Bool
func object<T: Codable>(type: T.Type, for key: Key) -> T?
func set(_ newValue: Bool, for key: Key)
func set(_ newValue: Int, for key: Key)
func set<T: Codable>(_ newValue: T?, for key: Key)
import React from 'react';
import PropTypes from 'prop-types';
import deburr from 'lodash/deburr';
import keycode from 'keycode';
import Downshift from 'downshift';
import { withStyles } from '@material-ui/core';
import TextField from '@material-ui/core/TextField';
import Paper from '@material-ui/core/Paper';
import MenuItem from '@material-ui/core/MenuItem';
import Chip from '@material-ui/core/Chip';
{
"name": "create-react-app",
"version": "0.0.0",
"private": true,
"dependencies": {
"@date-io/date-fns": "1.1.0",
"@material-ui/core": "3.9.2",
"@material-ui/icons": "3.0.2",
"auth0-lock": "11.14.1",
"autosuggest-highlight": "3.1.1",
import React, {useState, Component} from 'react';
import PropTypes from 'prop-types';
import deburr from 'lodash/deburr';
import Autosuggest from 'react-autosuggest';
import match from 'autosuggest-highlight/match';
import parse from 'autosuggest-highlight/parse';
import TextField from '@material-ui/core/TextField';
import Paper from '@material-ui/core/Paper';
import MenuItem from '@material-ui/core/MenuItem';
import { withStyles } from '@material-ui/core/styles';
@aturan23
aturan23 / NetSearchPushRow
Last active August 13, 2018 04:12
Eureka custom PushRow
import Eureka
open class _NetworkSearchSelectorViewController<Row: SelectableRowType, OptionsRow: OptionsProviderRow>: SelectorViewController<OptionsRow>, UISearchResultsUpdating where Row.Cell.Value: SearchItem {
let searchController = UISearchController(searchResultsController: nil)
var originalOptions = [ListCheckRow<Row.Cell.Value>]()
var currentOptions = [ListCheckRow<Row.Cell.Value>]()
@aturan23
aturan23 / MemoryUsage
Created November 24, 2017 06:46
Memory usage of sorts
package lect;
public class MemoryUsage {
private static final long MEGABYTE = 1024L * 1024L;
private static final long KILOBYTE = 1024L;
public static long bytesToKilobytes(long bytes) {
return bytes / KILOBYTE;
}
package lect;
public class MyArrayList<E> extends MyAbstractList<E> {
public static final int INITIAL_CAPACITY = 16;
private E[] data = (E[])new Object[INITIAL_CAPACITY];
/** Create a default list */
public MyArrayList() {
}
package lect;
import java.util.Comparator;
import java.util.Iterator;
public class MyLinkedList<E> extends MyAbstractList<E> {
public Node<E> head;
private Node<E> tail;
Node<E> sorted;