Skip to content

Instantly share code, notes, and snippets.

View kururu-abdo's full-sized avatar
😍
Learning

kururu kururu-abdo

😍
Learning
View GitHub Profile
@kururu-abdo
kururu-abdo / Extensions.cs
Created March 21, 2024 20:27 — forked from karenpayneoregon/Extensions.cs
Working with strings and ternary operator
using System.Text.RegularExpressions;
public static class StringExtensions
{
// remove double spaces
public static string RemoveExtraSpaces(this string sender, bool trimEnd = false)
{
const RegexOptions options = RegexOptions.None;
var regex = new Regex("[ ]{2,}", options);
var result = regex.Replace(sender, " ");
@kururu-abdo
kururu-abdo / get-medium-stats.js
Created December 1, 2022 13:02 — forked from igeligel/get-medium-stats.js
medium-get-totals
const totalTypes = {
VIEWS: 2,
READS: 3,
FANS: 5
};
const getTotal = tableColumn =>
[
...document.querySelectorAll(
`td:nth-child(${tableColumn}) > span.sortableTable-number`
@kururu-abdo
kururu-abdo / gist:05e400561707c89be456f6f701905995
Created August 10, 2022 14:31 — forked from dodyg/gist:5616605
Kotlin Programming Language Cheat Sheet Part 2

This is a quick guide to Kotlin programming language. The previous part of this guide is here

#Object Oriented

fun main(args : Array<String>) {
  class local (val x : Int)
  
  val y = local(10)
 println("${y.x}")
@kururu-abdo
kururu-abdo / gist:a721c3b5eddb60b9c81a288c0a5b97cb
Created August 10, 2022 14:31 — forked from dodyg/gist:5823184
Kotlin Programming Language Cheat Sheet Part 1

#Intro

Kotlin is a new programming language for the JVM. It produces Java bytecode, supports Android and generates JavaScript. The latest version of the language is Kotlin M5.3

Kotlin project website is at kotlin.jetbrains.org.

All the codes here can be copied and run on Kotlin online editor.

Let's get started.

@kururu-abdo
kururu-abdo / main.dart
Created February 9, 2022 11:24 — forked from eduardoflorence/main.dart
GetX - Sample Translation with GetStorage, GetxService, DropDownButton and PopMenuButton
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:get_storage/get_storage.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await initialConfig();
final storage = Get.find<StorageService>();
@kururu-abdo
kururu-abdo / main_screen.dart
Created January 25, 2022 07:09 — forked from sergicastellsague/main_screen.dart
Belongs to medium article
class MainScreen extends StatefulWidget {
State createState() => MainScreenState();
}
class MainScreenState extends State<MainScreen> {
var _androidAppRetain = MethodChannel("android_app_retain");
@override
void initState() {
super.initState();
@kururu-abdo
kururu-abdo / MainActivity.kt
Created January 25, 2022 07:09 — forked from sergicastellsague/MainActivity.kt
Belongs to medium article
class MainActivity : FlutterActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
GeneratedPluginRegistrant.registerWith(this)
MethodChannel(flutterView, "android_app_retain").apply {
setMethodCallHandler { method, result ->
if (method.method == "sendToBackground") {
moveTaskToBack(true)
}
private fun createNativeView(handle: Long) {
FlutterMain.ensureInitializationComplete(this, arrayOf())
val nativeView = FlutterNativeView(this, true)
val callback = FlutterCallbackInformation.lookupCallbackInformation(handle)
nativeView.runFromBundle(FlutterRunArguments().apply {
bundlePath = FlutterMain.findAppBundlePath(this@Service)
libraryPath = callback.callbackLibraryPath
entrypoint = callback.callbackName
@kururu-abdo
kururu-abdo / location.provider.dart
Created August 29, 2021 19:33 — forked from mskasal/location.provider.dart
Location provider for flutter projects, Riverpod, Location
import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:location/location.dart';
class PersonLocationProvider extends ChangeNotifier {
Location _location = new Location();
PermissionStatus _permissionGranted;
StreamController<LocationData> currentLocation = StreamController.broadcast();
@kururu-abdo
kururu-abdo / custom_info_window.dart
Created August 10, 2021 23:03 — forked from abhishekduhoon/custom_info_window.dart
Widget based Custom Info Window for Google Maps in Flutter
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:provider/provider.dart';
import 'package:clippy_flutter/clippy_flutter.dart';
void main() {
runApp(
ChangeNotifierProvider(