Skip to content

Instantly share code, notes, and snippets.

View chnirt's full-sized avatar
🦦
On vacation

Chnirt chnirt

🦦
On vacation
View GitHub Profile
@chnirt
chnirt / run.java
Created May 21, 2022 08:57
Find the second most frequent letter with multiple conditions
// There is a string s, which consists of lowercase letters from twenty-six alphabet letters "a" through "z". You are asked to find the second most frequent letter in this string. For example, if s = “xddxdca”, then the second most frequent letter in this string is“x”.
// Even if there is more than one letter that are most frequent, none of them should count toward picking the second most frequent letter. For example, if s = “jpcpjppcyycyy”, then the most frequent letters in this string are “p” and “y”, as there are four of each in the string. In this case, the second most frequent letter in this string will be “c”, as there are three "c"s in this string.
// If there is more than one second most frequent letter in the given string, then arrange them in alphabetical order. For example, if s = “brbabrrara”, then the second most frequent letters here are “b” and “a”. Arrange them in alphabetical order, and you get “ab”.
// In the case where there is no second most frequent letter in the given string s, you mu
@chnirt
chnirt / README.md
Last active August 23, 2022 07:50
React native clear cache

For Android

npm cache clean --force 
cd android && ./gradlew clean
npm i
npm run android

For iOS

Desktop -> About this Mac -> Storage -> Manage -> Developer -> delete Project Build Data and Indexes
@chnirt
chnirt / index.js
Last active June 29, 2022 05:24
useFetch for firebase with fetch and load more
import { useCallback, useEffect, useState } from 'react'
import {
collection,
query,
orderBy,
limit,
startAfter,
onSnapshot,
} from 'firebase/firestore'
@chnirt
chnirt / README.md
Last active January 10, 2023 10:10
Encrypt and decrypt app

Hello world

Quick Overview

npx https://gist.github.com/chnirt/1445f38cb8df53c00fc15a84ef163cc2

if you've previously installed chnirt-build-app globally via npx https://gist.github.com/chnirt/1445f38cb8df53c00fc15a84ef163cc2, we recommend you uninstall the package using npm uninstall -g chnirt-build-app or yarn global remove chnirt-build-app to ensure that npx always uses the latest version. NOTE: remember to clear cache using npx clear-npx-cache

@chnirt
chnirt / README.md
Created July 15, 2022 05:34
Git cheatsheet

When you commited your own code to remote then revert before commit:

git reset --hard HEAD~1

Push new code to override remote server:

git push --force origin
@chnirt
chnirt / README.md
Last active April 19, 2023 03:05
Setup from scratch your new MacBook for Develop
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

nano ~/.zshrc
PROMPT='%n~$'
export NVM_DIR="${HOME}/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
export PATH=${PATH}:$HOME/Library/Android/sdk/platform-tools/
    
brew doctor