Skip to content

Instantly share code, notes, and snippets.

View Nodirbek-Sharipov's full-sized avatar
👽
sup

Nodirbek Sharipov Nodirbek-Sharipov

👽
sup
View GitHub Profile
@Nodirbek-Sharipov
Nodirbek-Sharipov / MyProfilePhoto.js
Last active October 6, 2022 17:08
MyProfilePhoto.js
import React from 'react'
import Colors from '../utils/Colors'
import { connect } from 'react-redux'
import CustomIcon from './CustomIcon'
import { bindActionCreators } from 'redux'
import { AVATAR_API } from '../utils/helpers'
import { openSettings } from 'react-native-permissions'
import Feather from 'react-native-vector-icons/Feather'
import ImagePicker from 'react-native-image-crop-picker'
import * as ProfileReducer from '../redux/reducers/ProfileReducer'
{
"name": "appName",
"version": "0.0.1",
"private": true,
"config": {
"env": "dev"
},
"scripts": {
"config:env": "yarn config set appName:env",
"setup:android": "yarn --frozen-lockfile && jetify",
module.exports = {
arrowParens: 'always',
bracketSpacing: true,
indent: 2,
printWidth: 100,
singleQuote: true,
semi: true,
trailingComma: 'all',
};
module.exports = {
root: true,
extends: ['@react-native-community', 'prettier'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'prettier', 'eslint-plugin-import'],
overrides: [
{
files: ['*.ts', '*.tsx'],
settings: {
'import/resolver': {

Recent SQL experiences

1. From O(N) to O(1)

In a recent project, we had a REST API with GET /profile route, which returned profile data. Profile data needed to be taken from users table as well as many other tables like: universities, identities, sectors, companies, question_answers, can_help. All of those subsequent tables are related to user with foreign key and initially there were N network requests for each table query, which was taking O(N) linear time to execute. After optimisations the time function was reduced to O(1) constant time. The optimisation was to send queries in bulk (Multiple select statemets in a single network request) and extract each table afterwards from the DB response like so:

const [ query_tables ] = await db.read.raw(`
	SELECT
		un.id AS id,
		un.name AS name
	FROM universities un
	INNER JOIN user_universities us
// ----------------------------------------
#import <UserNotifications/UserNotifications.h>
// ----------------------------------------
#import "AppDelegate.h"
#import <Firebase.h>
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
name: Docker Image CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
upstream http_backend {
server 127.0.0.1:8080;
keepalive 16;
}
server {
listen 80;
server_name ec2-34-207-248-237.compute-1.amazonaws.com;
location / {
proxy_pass http://http_backend;
<!DOCTYPE html>
<html>
<head>
<title>Menu</title>
<script src="jquery.min.js"></script>
<script>
function change_bg_radgr(event) {
var div_pos = $(".radial-gradient").offset();
var x_cord = event.pageX - div_pos.left;

Auto run iTunes-Sniper (by Wes Bos) upon system startup in mac OS

cd ~/Library/LaunchAgents

touch com.spotify.daemon.plist

vi com.spotify.daemon.plist

customize & insert following & save and exit vim