Skip to content

Instantly share code, notes, and snippets.

View gsandaru's full-sized avatar

GIHAN SANDARU gsandaru

View GitHub Profile
@faruktoptas
faruktoptas / debounce.kt
Created March 5, 2020 06:28
Kotlin coroutine debounce for EditText
fun <T> debounce(
waitMs: Long = 300L,
scope: CoroutineScope,
destinationFunction: (T) -> Unit
): (T) -> Unit {
var debounceJob: Job? = null
return { param: T ->
debounceJob?.cancel()
debounceJob = scope.launch {
delay(waitMs)
@kdsuneraavinash
kdsuneraavinash / basic_usage.dart
Last active October 28, 2023 03:22
Localization file need to implement Sinhala language in flutter using MaterialLocalizations class
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// The root of application.
@override
Widget build(BuildContext context) {
return MaterialApp(
locale: Locale('si'),
@krishnasrinivas
krishnasrinivas / bucket-policies-primer.md
Created September 9, 2017 19:51 — forked from harshavardhana/bucket-policies-primer.md
Explanation of bucket polices by example

Bucket Policy

Bucket policy is an access policy available for you to grant anonymous permissions to your Minio resources. Bucket policy uses JSON-based access policy language.

This section presents a few examples of typical use cases for bucket policies. The policies use testbucket strings in the resource value. To test these policies, you need to replace these strings with your bucket name. For more information please read Amazon S3 access policy language

Granting Read-Only Permission to an Anonymous User

The following example policy grants the s3:GetObject permission to any public anonymous users. This permission allows anyone to read the object data under testbucket, which is useful for when you have publicly readable assets. A typical example is a website assets stored in testbucket.

@nishantmodak
nishantmodak / nginx.conf.default
Last active February 29, 2024 13:48
Default Nginx Conf
#user nobody;
#Defines which Linux system user will own and run the Nginx server
worker_processes 1;
#Referes to single threaded process. Generally set to be equal to the number of CPUs or cores.
#error_log logs/error.log; #error_log logs/error.log notice;
#Specifies the file where server logs.