Skip to content

Instantly share code, notes, and snippets.

View bytao7mao's full-sized avatar
🐢
Being lazy

Marius Nicolae bytao7mao

🐢
Being lazy
View GitHub Profile
@bytao7mao
bytao7mao / HowManyDays.java
Created February 26, 2023 19:45
Easy way to calculate days between starting point and finish
public class Main {
public static void main(String[] args) throws Exception {
LocalDate fictivePresent = LocalDate.of(2023, 9, 1);
LocalDate past = LocalDate.now(ZoneId.of("America/New_York"));
print(calculateDaysFromPastToPresent(fictivePresent, past));
}
@bytao7mao
bytao7mao / ShareCompat.java
Created January 13, 2022 21:55
ShareCompat intent android example
public void shareText(String text) {
String mimeType = "text/plain";
String title = "Example title";
Intent shareIntent = ShareCompat.IntentBuilder.from(this)
.setType(mimeType)
.setText(text)
.getIntent();
if (shareIntent.resolveActivity(getPackageManager()) != null){
startActivity(shareIntent);
@bytao7mao
bytao7mao / findCharsThatOccursOnlyOnce.java
Created December 29, 2021 15:11
interview question, chars from a string that occurs only once
public class ClassCounterForLetters {
public static void main(String[] args) {
ClassCounterForLetters classCounterForLetters = new ClassCounterForLetters();
String x = "SILLYSPIDERS";
System.out.println(classCounterForLetters.returnNumberOfLetters(x));
Set<Map.Entry<Character, Integer>> lhmap =
classCounterForLetters.returnNumberOfLetters(x);
for (Map.Entry<Character, Integer> data:lhmap){
@bytao7mao
bytao7mao / findMostUsedChar.java
Created December 27, 2021 21:44
find the most used character from a string input
public class InterviewQuestion {
public static void main(String[] args) {
String example = "GOD_BLESS_SPIDERMAN";
findMostUsedChar(example);
}
private static void findMostUsedChar(String str) {
char[] chars = str.toCharArray();
int size = chars.length;
@bytao7mao
bytao7mao / RecycleViewCode.java
Created January 14, 2020 05:44
code inspection recyclerview
package com.example.javaalgorithmsrecipes;
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Filter;
import android.widget.Filterable;
import android.widget.ImageView;
@bytao7mao
bytao7mao / instalationDate.ps1
Created November 21, 2019 22:00
Windows instalation date powershell
PS > $os = get-wmiobject win32_operatingsystem
PS > $os.ConvertToDateTime($os.InstallDate) -f "MM/dd/yyyy"
@bytao7mao
bytao7mao / db.json
Created November 5, 2019 10:12
tip of the day for QuitHabit! NoSmoke
[
{
"id": 1,
"name": "Don't be pushed around by the fears in your mind. Be led by the dreams in your heart. \n― Roy T. Bennett",
"nameRO": "Adevăratele greutăți pot fi depașite. Doar cele imaginare sunt de neînvins. \n– Theodore V. Nail",
"nameFR": "Ne soyez pas poussé par les peurs dans votre esprit. Soyez dirigé par les rêves dans votre coeur.\n- Roy T. Bennett",
"nameDE": "Lass dich nicht von den Ängsten in deinem Kopf herumschubsen. Lass dich von den Träumen in deinem Herzen leiten.\n- Roy T. Bennett",
"nameES": "No te dejes llevar por los miedos en tu mente. Déjate llevar por los sueños en tu corazón.\n- Roy T. Bennett",
"nameZH": "不要被您内心的恐惧所困扰。被你内心的梦想所带领。 \n– 罗伊·T·贝内特"
},
@bytao7mao
bytao7mao / android_typo_guidelines
Created October 29, 2019 15:16
android typography guidelines
Android Mobile Typography Guidelines
Here’s a quick summary of styles. See below for visual reference and more in-depth guidelines.
ELEMENT SIZING NOTES
Page titles 20sp
Paragraph text 14sp
List titles 14sp Show importance using medium weight
List item titles,
Important text snippets 16sp
Secondary text,
2014 Material Design color palettes
These color palettes, originally created by Material Design in 2014, are comprised of colors designed to work together harmoniously, and can be used to develop...
READ MORE
These color palettes, originally created by Material Design in 2014, are comprised of colors designed to work together harmoniously, and can be used to develop your brand palette. To generate your own harmonious palettes, use either the palette generation tool or Material Theme Editor.
Red 50
#FFEBEE
100
#FFCDD2
@bytao7mao
bytao7mao / activity_main.xml
Last active October 21, 2019 14:33
last activity main
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<androidx.constraintlayout.widget.ConstraintLayout