Skip to content

Instantly share code, notes, and snippets.

@naumanahmed19
naumanahmed19 / version-check.dart
Last active February 25, 2024 14:51
Flutter Force Update IOS and Android App Version
//Prompt users to update app if there is a new version available
//Uses url_launcher package
import 'package:url_launcher/url_launcher.dart';
const APP_STORE_URL =
'https://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftwareUpdate?id=YOUR-APP-ID&mt=8';
const PLAY_STORE_URL =
'https://play.google.com/store/apps/details?id=YOUR-APP-ID';
@naumanahmed19
naumanahmed19 / ChangePasswordController.php
Created November 20, 2016 16:20
Adding a change password functionality in Laravel
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use App\User;
use Illuminate\Support\Facades\Input;
@naumanahmed19
naumanahmed19 / index.js
Created October 7, 2018 22:19
Firebase Firestore Cloud Messaging(Notification) Server Function
const functions = require("firebase-functions");
var request = require("request");
var API_KEY = "YOUR-API-KEY"; // Your Firebase Cloud Messaging Server API key
function sendNotificationToUser(userId, message) {
request(
{
url: "https://fcm.googleapis.com/fcm/send",
method: "POST",
@naumanahmed19
naumanahmed19 / flutter-dropdown.dart
Created October 16, 2018 22:19
Flutter DropdownButton With Validation
String _town;
_townField() {
return FormField<String>(
validator: (value) {
if (value == null) {
return "Select your area";
}
},
onSaved: (value) {
formData['town'] = value;
@naumanahmed19
naumanahmed19 / flutter-firebase-topics-example.dart
Created September 29, 2018 11:01
A very simple example for firebase topics
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/material.dart';
void main() => runApp(MaterialApp(
home: MyApp(),
));
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
@naumanahmed19
naumanahmed19 / package.json
Created April 16, 2018 19:06
Paper Packages
{
"name": "Paper",
"version": "1.8.3",
"slug": "paper",
"description": "A Multipuprpose HTML Template",
"main": "app/dist/index.html",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Nomi <naumanahmed19@gmail.com> (http//xvelopers.com)",
@naumanahmed19
naumanahmed19 / gulpfile.js
Created April 16, 2018 19:05
Paper Gulp File
//Gulp Packages =============================================
var fs = require('fs-extra');
var app = JSON.parse(fs.readFileSync('./package.json'));
var ftp = JSON.parse(fs.readFileSync('./ftp.config'));
var gulp = require('gulp'),
webpack = require('webpack-stream'),
sass = require('gulp-sass'),
sourcemaps = require('gulp-sourcemaps'),
browserSync = require('browser-sync'),
@naumanahmed19
naumanahmed19 / form-data.service.ts
Created October 13, 2017 17:32
Angular4 Form Data service to get all inputs fields and uploaded files at once
import { Injectable } from '@angular/core';
@Injectable()
export class FormDataService {
constructor() { }
formData(formGroup, fileInput:any='',fileInputName:string = 'file') {
let formData = new FormData();
if(fileInput){