Skip to content

Instantly share code, notes, and snippets.

View graymind75's full-sized avatar
🖥️
Coding

Benyamin Eskandari graymind75

🖥️
Coding
View GitHub Profile
@graymind75
graymind75 / findWord.cpp
Created April 23, 2023 15:45
a program to find a start index of a word in a phrase
#include <iostream>
#include <string>
using namespace std;
string getStringFromInput(int length);
int searchForTheQuery(string totalPhrase, string queryPhrase);
int main()
{
int n, m;
@graymind75
graymind75 / NetworkHelper.kt
Last active August 23, 2022 18:26
a singleton class to check the network connection state, use both of the NetworkCallback and ConnectivityManager to support older devices
package com.graymind75
import android.content.Context
import android.net.*
import android.os.Build
import androidx.annotation.RequiresApi
/**
* singleton class to check the network connection state
* It's use the old ConnectivityManager.activeNetworkInfo way for pre LOLLIPOP
@graymind75
graymind75 / UUIDHelper.java
Last active July 27, 2020 17:36
sometimes we have to make a unique identifier for detecting each device. this class provides a UUID combined with Time in Millisec to generate a unique identifier.
package com.graymind;
import android.content.Context;
import java.io.IOException;
import java.util.UUID;
public class UUIDHelper {
private static final String TAG = "UUIDHelper";
private static final String PATH_ON_INTERNAL_STORAGE = "/Android/data/com.graymind/";
private static final String FILE_NAME = ".uuid_content";