Skip to content

Instantly share code, notes, and snippets.

View haykgalstyan's full-sized avatar

Hayk Galstyan haykgalstyan

  • Yerevan
View GitHub Profile
@remarkablemark
remarkablemark / order-of-growth-classifications.md
Last active July 17, 2023 12:44
Common order-of-growth classifications

Common order-of-growth classifications

order of growth name code example description example T(2N) / T(N)
1 constant a = b + c statement add 3 numbers 1
log N logarithmic while (N > 1)
{ n = N / 2; }
divide in half binary search ~ 1
N linear for (i = 0; i < N; i++)
{ /* ... */ }
loop find the maximum 2
N log N linearithmic
@graphicbeacon
graphicbeacon / main.dart
Last active February 28, 2024 20:22
Flutter GestureDetector example - draggable square
import 'package:flutter/material.dart';
void main() => runApp(MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Padding(
// padding: const EdgeInsets.only(top: 20, left: 20, right: 20),
padding: const EdgeInsets.all(0),
child: Page()
)
@Zhuinden
Zhuinden / FragmentViewBindingDelegate.kt
Last active February 11, 2025 09:25
Fragment view binding delegate
// https://github.com/Zhuinden/fragmentviewbindingdelegate-kt
import android.view.View
import androidx.fragment.app.Fragment
import androidx.lifecycle.DefaultLifecycleObserver
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.Observer
import androidx.viewbinding.ViewBinding
import kotlin.properties.ReadOnlyProperty
@NickHolcombe
NickHolcombe / ListAdapterWithHeader.kt
Last active October 18, 2023 00:16
Example of a RecyclerView Adapter based on ListAdapter with a header
package example
import android.support.v7.recyclerview.extensions.AsyncDifferConfig
import android.support.v7.recyclerview.extensions.AsyncListDiffer
import android.support.v7.util.DiffUtil
import android.support.v7.util.ListUpdateCallback
import android.support.v7.widget.RecyclerView
/**
* {@link RecyclerView.Adapter RecyclerView.Adapter} base class based on
@veox
veox / erc20.abi.json
Created January 21, 2018 14:59
ERC20 ABI in JSON format
[
{
"constant": true,
"inputs": [],
"name": "name",
"outputs": [
{
"name": "",
"type": "string"
}
@amitaymolko
amitaymolko / HttpRequest.java
Last active August 15, 2020 01:53
Simple HttpURLConnection wrapper class
package com.amitaymolko.network;
import java.util.HashMap;
/**
* Created by amitaymolko on 2/16/16.
*/
public class HttpRequest {
@asanand3
asanand3 / undoDrawing.java
Created January 11, 2016 11:51
undo drawing code
import java.util.ArrayList;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
@janheinrichmerker
janheinrichmerker / LICENSE
Last active August 29, 2023 14:28
LinearLayoutManager implementation that stretches to fit all list items on screen and disables scrolling. Useful for dashboards etc.
MIT License
Copyright (c) 2020 Jan Heinrich Reimer
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@slightfoot
slightfoot / MoveViewTouchListener.java
Created May 30, 2015 23:43
Move View Touch Listener Example
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;
/**
* @author Simon Lightfoot <[email protected]>
*/
public class MoveViewTouchListener
implements View.OnTouchListener
{
/*
* The MIT License (MIT)
*
* Copyright (c) 2015 - Nathan Barraille
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is