Skip to content

Instantly share code, notes, and snippets.

View trulymittal's full-sized avatar
🏠
Working from home

Truly Mittal trulymittal

🏠
Working from home
View GitHub Profile
public void sendmail() {
String[] TO_EMAILS = {"emailone@example.com", "emailtwo@example.com"};
String[] CC = {"emailthree@example.com"};
String[] BCC = {"emailfour@example.com"};
Intent intent = new Intent(Intent.ACTION_SENDTO);
intent.setData(Uri.parse("mailto:"));
intent.putExtra(Intent.EXTRA_EMAIL, TO_EMAILS);
intent.putExtra(Intent.EXTRA_CC, CC);

Checking Network connection in android

Step 1: Add this to AndroidManifest.xml

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

Step 2: Create this method where ever you like and use the result

@trulymittal
trulymittal / axios-interceptors-refresh-token.js
Created July 4, 2020 19:10 — forked from mkjiau/axios-interceptors-refresh-token.js
Axios interceptors for token refreshing and more than 2 async requests available
let isRefreshing = false;
let refreshSubscribers = [];
const instance = axios.create({
baseURL: Config.API_URL,
});
instance.interceptors.response.use(response => {
return response;
}, error => {
@trulymittal
trulymittal / CODE-REVIEW.md
Last active March 21, 2021 09:48
Rules for submitting your repo to be reviewed on the YouTube channel - yoursTruly

How to submit the Repo?

Fun Fact: 🤓

You can completely ignore what I say or comment or review or the rating I provide. I only speak what I think is best according to me. There is no rule of thumb. Even what I say in review might be completely wrong in your context but I will try my best. And secondly, don't be put off by my critical comments.

What can you submit?

  • Android apps (java/kotlin)
@trulymittal
trulymittal / .htaccess
Last active April 13, 2021 09:21
.htaccess file to be used with Docker Compose for Wordpress setup, if you want to change php limits.
# BEGIN WordPress
php_value memory_limit 256M
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
# END WordPress
@trulymittal
trulymittal / docker-compose.yaml
Created August 6, 2019 14:57
Docker Compose file for Wordpress setup
version: "3"
services:
#Database service
mysql_db:
image: mysql:5.7
restart: always
environment:
MYSQL_ROOT_PASSWORD: some_password_of_ur_choice
MYSQL_DATABASE: name_your_wordpress_database

Running Nginx container using Docker

To start setting up Nginx container

Step 1: Pull the latest image from docker hub (https://hub.docker.com)

docker pull nginx
@trulymittal
trulymittal / tailwind-colors.js
Last active March 22, 2024 16:16
List of all default Tailwind CSS colors from the default theme
export const colors = {
black: '#000',
white: '#fff',
rose: {
'50': '#fff1f2',
'100': '#ffe4e6',
'200': '#fecdd3',
'300': '#fda4af',
'400': '#fb7185',
'500': '#f43f5e',
@trulymittal
trulymittal / google-drive-api.js
Last active April 15, 2024 07:10
Gist to demonstrate Google Drive API using NodeJs
/*
Google Drive API:
Demonstration to:
1. upload
2. delete
3. create public URL of a file.
required npm package: googleapis
*/
const { google } = require('googleapis');