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 / 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:
@Nidal-Bakir
Nidal-Bakir / chat_message_render_box.dart
Created April 19, 2023 08:47 — forked from craiglabenz/chat_message_render_box.dart
Demonstrates a custom RenderObject that draws chat messages like WhatsApp, where the `sentAt` timestamp is tucked into the last line if it fits
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
@Nidal-Bakir
Nidal-Bakir / main.dart
Last active January 13, 2023 10:22 — forked from slightfoot/main.dart
A base line to code an overlay in flutter. like search overlay on Text-Field
// 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: