Skip to content

Instantly share code, notes, and snippets.

View Nidal-Bakir's full-sized avatar
🏹
segmentation violation

Nidal Bakir Nidal-Bakir

🏹
segmentation violation
View GitHub Profile
@Nidal-Bakir
Nidal-Bakir / device_type.dart
Created July 10, 2024 16:38
Device type (phone/tablet) and orientation (landscape/portrait)
import 'dart:ui' as ui;
import 'package:flutter/widgets.dart';
import 'package:wow_shopping/backend/backend.dart';
enum DeviceType {
unknown,
phone,
tablet,
}
@Nidal-Bakir
Nidal-Bakir / github_sections.md
Created July 8, 2024 23:45
github sections in md files

Simple alerts

Note

This is a note.

Tip

This is a tip. (Supported since 14 Nov 2023)

Important

Crutial information comes here.

@Nidal-Bakir
Nidal-Bakir / is_valid_interface.go
Last active June 29, 2024 23:30
Check if a Golang interface is valid (not nil) and does not point to a possibly nil value
func IsValidInterface(i interface{}) bool {
iv := reflect.ValueOf(i)
return iv.IsValid() && !iv.IsNil()
}
@Nidal-Bakir
Nidal-Bakir / falsehoods-programming-time-list.md
Created May 29, 2024 10:02 — forked from timvisee/falsehoods-programming-time-list.md
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
@Nidal-Bakir
Nidal-Bakir / sliver_magic.dart
Last active May 8, 2024 16:58 — forked from slightfoot/sliver_magic.dart
SliversPersistentHeader in both directions (top,bottom) || Sliver Magic - by Simon Lightfoot - #HumpdayQandA - 19th July 2023 - #Flutter #Dart - https://www.youtube.com/live/zNOZD0JSFQY?feature=share&t=7315
// MIT License
//
// Copyright (c) 2023 Simon Lightfoot
//
// 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:
import 'dart:async';
import 'dart:convert';
import 'dart:math';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import '../utils/logger/logger.dart';
const _channelId = '<your_channel_id>';
@Nidal-Bakir
Nidal-Bakir / scroll_parent_on_overflow.dart
Created March 27, 2024 18:03 — forked from slightfoot/scroll_parent_on_overflow.dart
Scroll Parent On Overflow - by Simon lightfoot - Humpday Q&A :: 20th March 2024 #Flutter #Dart - https://www.youtube.com/watch?v=qByAoUXOb2M
// MIT License
//
// Copyright (c) 2024 Simon Lightfoot
//
// 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:
@Nidal-Bakir
Nidal-Bakir / maps_launcher.dart
Created January 17, 2024 09:07
Launch a ios/google native map app with lat,long and label
import 'dart:io';
import 'package:url_launcher/url_launcher.dart' as url_launcher;
import 'logger/logger.dart';
class MapsLauncher {
static Uri createCoordinatesUri({
required double latitude,
required double longitude,
@Nidal-Bakir
Nidal-Bakir / dart_http_array.dart
Created January 17, 2024 09:03
http-array format
/// This will generate and add http-array-format from [array] to the [map]
/// with [httpArrayName] as the name of the array.
///
/// If the [array] is null or empty will do nothing.
///
/// e.g:
/// ```
/// gAddHttpArrayFormatToMap(array: [14,55], httpArrayName: 'brand_id', map: someJsonMap);
/// // this will add to the [someJsonMap] parameter the following data
/// // {'brand_id[0]': 14, 'brand_id[1]': 55}
@Nidal-Bakir
Nidal-Bakir / name_tagging.dart
Created December 6, 2023 21:23 — forked from slightfoot/name_tagging.dart
Name Tagging during input example - by Simon Lightfoot - Humpday Q&A :: 6th December 2023 #Flutter #Dart - https://www.youtube.com/watch?v=TaHhT1QdYUM
// MIT License
//
// Copyright (c) 2023 Simon Lightfoot
//
// 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: