Skip to content

Instantly share code, notes, and snippets.

View Abdullamhd's full-sized avatar

Abdullah Mohammed Abdullamhd

View GitHub Profile
@Abdullamhd
Abdullamhd / LocationHelperExt.kt
Last active June 5, 2018 10:05
kotlin extension function to request location updates from activity with automatic lifecycle management with lifecycle observer , you don't have to unregister the listener
import android.Manifest.permission.ACCESS_COARSE_LOCATION
import android.Manifest.permission.ACCESS_FINE_LOCATION
import android.annotation.SuppressLint
import android.arch.lifecycle.Lifecycle
import android.arch.lifecycle.LifecycleObserver
import android.arch.lifecycle.OnLifecycleEvent
import android.content.Context
import android.location.Criteria
import android.location.Location
@Abdullamhd
Abdullamhd / gist:d6c52f578fc62964b1d82116e9363041
Last active September 17, 2018 06:34
the whole widget rebuild when i press like button in flutter
import 'dart:io';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:foodgram/firebase_auth.dart';
import 'package:foodgram/preview_post.dart';
import 'package:foodgram/random_asset.dart';
import 'package:foodgram/user.dart';
import 'package:image_picker/image_picker.dart';
@Abdullamhd
Abdullamhd / sin_animation.dart
Created June 3, 2019 10:23
animate the sine wave using canvas animation and Tween in flutter
import 'package:flutter/material.dart';
import 'dart:math' as Math;
class AnimationTest extends StatefulWidget {
@override
_AnimationTestState createState() => _AnimationTestState();
}
class _AnimationTestState extends State<AnimationTest>
with SingleTickerProviderStateMixin {
@Abdullamhd
Abdullamhd / resizing_animation.dart
Created June 3, 2019 11:00
circle resizing animation in flutter
import 'package:flutter/material.dart';
import 'dart:math' as Math;
class AnimationTest extends StatefulWidget {
@override
_AnimationTestState createState() => _AnimationTestState();
}
class _AnimationTestState extends State<AnimationTest>
with SingleTickerProviderStateMixin {
@Abdullamhd
Abdullamhd / animatedsin.dart
Created June 12, 2019 19:17
animatedSinWave
import 'package:flutter/material.dart';
import 'dart:math' as Math ;
class PainterPage extends StatefulWidget {
@override
_PainterPageState createState() => _PainterPageState();
}
class _PainterPageState extends State<PainterPage> with SingleTickerProviderStateMixin{
@Abdullamhd
Abdullamhd / lissajous_figure.dart
Created June 13, 2019 10:09
lissajous figure
import 'package:flutter/material.dart';
import 'dart:math' as Math;
class PainterPage extends StatefulWidget {
@override
_PainterPageState createState() => _PainterPageState();
}
class _PainterPageState extends State<PainterPage>
with SingleTickerProviderStateMixin {
@Abdullamhd
Abdullamhd / bubbles_3d.dart
Last active June 27, 2019 07:31
bubbles 3d in dart
import 'dart:typed_data';
import 'package:flutter/material.dart';
import 'dart:math';
import 'random_numbers_generator.dart';
import 'dart:ui' as ui;
class FractalView extends StatefulWidget {
@override
@Abdullamhd
Abdullamhd / cercomfrance_coord.dart
Last active September 30, 2019 10:23
find circomference points from center coordinate
import 'dart:math';
/// generate coordnates for cercomfrance
void main(){
var radius = 100.0 ;
var centerLat = 25.756037 ;
var centerLon = 55.969354 ;
@Abdullamhd
Abdullamhd / http_post.dart
Last active September 30, 2019 10:23
post json into server from dart
import 'package:http/http.dart' as http;
import 'dart:convert';
void main() async {
var url = 'http://localhost:3000/';
var body = jsonEncode({
'name' : 'Abood',
'Color' : 'blue'
});
@Abdullamhd
Abdullamhd / upload.js
Created September 30, 2019 10:21
upload file into node js express
app.post('/', async (req,res)=>{
try {
const result = await app.dbUtil.db.collection('users').insertOne(req.body)
res.json(result)
} catch(error){