Skip to content

Instantly share code, notes, and snippets.

Working from home

Nikhil Singh nikhilmufc7

Working from home
View GitHub Profile
View Shouter
function shouter(whatToShout) {
// your code here
/* From here down, you are not expected to
understand.... for now :)
Nothing to see here!
View Divisible
function isDivisible(divisee, divisor) {
return divisee % divisor === 0;
/* From here down, you are not expected to
understand.... for now :)
Nothing to see here!
View Error drill
function main() {
try {
catch(e) {
View compete the average
function average(numbers) {
var total = numbers[0];
for (var i=1; i < numbers.length; i++){
total += numbers[i];
return total/numbers.length;
View In your own words
What is scope? Your explanation should include the idea of global vs. local scope.
A. Scope is the declaration and accesibility that is possible in javascript, i.e the local and global scope wherin the variables
get stored in a global way, that can accessed anywhere in the program or
a Local variables have ,They can only be accessed within the function.
Why are global variables avoided?
Global variables are avoided because it creates a fuss if we programming 1000s of lines of codes.
Explain JavaScript's strict mode?
Strick mode is a way of writing secure javascript. It helps us in avoiding globad variables. It will throw an error if the
View deleting keys
function keyDeleter(obj) {
return obj;
var sampleObj = {
foo: 'foo',
bar: 'bar',
View data merge
function mergeDataStreams(stream1, stream2) {
var results = {};
for (var i=0; i < stream1.length; i++) {
results[stream1[i].id] = stream1[i];
for (var key in results) {
var otherData = stream2.find(
function(item) { return === key; });
for (var _key in otherData) {
View cat carousel
nikhilmufc7 / auth.dart
Last active April 23, 2023 13:17
Firebase Flutter Platform Exception Codes and example
View auth.dart
// Error Codes for SignUp
ERROR_OPERATION_NOT_ALLOWED` - Indicates that Anonymous accounts are not enabled.
ERROR_WEAK_PASSWORD - If the password is not strong enough.
ERROR_INVALID_EMAIL` - If the email address is malformed.
ERROR_EMAIL_ALREADY_IN_USE - If the email is already in use by a different account.
ERROR_INVALID_CREDENTIAL` - If the [email] address is malformed.
// sending password reset email
ERROR_INVALID_EMAIL` - If the [email] address is malformed.
View flutter_in_app_purchase.dart
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'dart:async';
import 'dart:io';
import 'package:flutter/services.dart';
import 'package:flutter_inapp_purchase/flutter_inapp_purchase.dart';
import 'package:flutter_screenutil/screenutil.dart';
import 'package:ielts/screens/home_screen.dart';
import 'package:ielts/utils/app_constants.dart';