Skip to content

Instantly share code, notes, and snippets.

@naumanahmed19
naumanahmed19 / version-check.dart
Last active May 15, 2022
Flutter Force Update IOS and Android App Version
View version-check.dart
//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 / flutter-dropdown.dart
Created Oct 16, 2018
Flutter DropdownButton With Validation
View flutter-dropdown.dart
String _town;
_townField() {
return FormField<String>(
validator: (value) {
if (value == null) {
return "Select your area";
}
},
onSaved: (value) {
formData['town'] = value;
@naumanahmed19
naumanahmed19 / index.js
Created Oct 7, 2018
Firebase Firestore Cloud Messaging(Notification) Server Function
View index.js
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-firebase-topics-example.dart
Created Sep 29, 2018
A very simple example for firebase topics
View flutter-firebase-topics-example.dart
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();
View package.json
{
"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)",
View gulpfile.js
//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 Oct 13, 2017
Angular4 Form Data service to get all inputs fields and uploaded files at once
View form-data.service.ts
import { Injectable } from '@angular/core';
@Injectable()
export class FormDataService {
constructor() { }
formData(formGroup, fileInput:any='',fileInputName:string = 'file') {
let formData = new FormData();
if(fileInput){
@naumanahmed19
naumanahmed19 / ChangePasswordController.php
Created Nov 20, 2016
Adding a change password functionality in Laravel
View ChangePasswordController.php
<?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;