Skip to content

Instantly share code, notes, and snippets.

View sunmeat's full-sized avatar
🐈
MEOW

Oleksandr Zahoruiko sunmeat

🐈
MEOW
View GitHub Profile
@sunmeat
sunmeat / different files
Last active February 12, 2024 07:14
main menu android example
res \ values \ strings.xml:
<resources>
<string name="app_name">Menu Example</string>
<string name="file">File</string>
<string name="edit">Edit</string>
<string name="view">View</string>
<string name="navigate">Navigate</string>
</resources>
@sunmeat
sunmeat / different files
Last active February 9, 2024 07:47
listview android example 2
layout\my_item.xml:
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="casual"
android:padding="10dp"
android:textColor="@color/pink"
android:textSize="30sp"
android:textStyle="bold" />
@sunmeat
sunmeat / different files
Last active February 9, 2024 07:34
listview android example 1
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<application
...
android:theme="@style/Theme.AppCompat.DayNight.DarkActionBar"
...
@sunmeat
sunmeat / different files
Created January 9, 2024 12:09
floating action button m3 example
activity_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
tools:context=".MainActivity">
@sunmeat
sunmeat / MainActivity.java
Created January 8, 2024 12:49
logs + save state
package com.sunmeat.myapplication;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity {
@sunmeat
sunmeat / 24.11
Created December 22, 2023 11:07 — forked from FromMeloriWithLove/24.11
SELECT
DB_NAME(database_id) AS DatabaseName,
SUM(size) * 8 AS SizeInBytes
FROM
sys.master_files
WHERE
database_id > 4
GROUP BY
database_id
ORDER BY
@sunmeat
sunmeat / Program.cs
Created November 24, 2023 14:15
strategy C# example
// Интерфейсы, описывающие абстрактное поведение
interface IFlyBehavior
{
void Fly();
}
interface IQuackBehavior
{
void Quack();
@sunmeat
sunmeat / Program.cs
Created November 24, 2023 14:12
adapter C# example
interface IChief
{
object MakeBreakfast();
object MakeLunch();
object MakeDinner();
}
class ScrewNut { }
class Pipe { }
@sunmeat
sunmeat / Program.cs
Created November 24, 2023 14:10
facade C# example
class SkiRent // аренда снаряжения
{
public double RentBoots(int feetSize, int skierLevel) // ботинки
{
double price = 159.99;
// if (feetSize < 40) price -= 20; // скидка для детей
return price;
}
@sunmeat
sunmeat / Program.cs
Created November 24, 2023 14:04
factory method C# example
// Абстрактный класс для продуктов-диалогов
abstract class Dialog
{
public abstract void Render();
public abstract void Click();
}
// Конкретный продукт диалога для Windows
class WindowsDialog : Dialog
{