- In dart unassigned variables are by default assigned null at initialization.
- In Null safety a variable with a static type should be assigned some value at initialization
or if that variable is to be assigned a value later then should be declare with
late
or made null aware by using ? operator after its type. - Statically typed variables declared without null aware (?) operator can never be null in Null safety
@required
is changed torequired
in Null Safety- We have various operators and annotations in Null Safety such as
?. ?? ??= !. late required
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:async'; | |
import 'dart:convert'; | |
import 'package:firebase_performance/firebase_performance.dart'; | |
import 'package:http/http.dart' as http; | |
import '../../logger_service.dart'; | |
import '../../httpClient.dart'; // API_BASE_URL in this file | |
enum RequestType { GET, POST, DELETE, PUT } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const rateLimit = require("express-rate-limit"); | |
const RateLimitRedis = require("rate-limit-redis"); | |
const { REDIS_HOST } = process.env; | |
const RedisClient = require("ioredis"); | |
// Create a `ioredis` client | |
const options = REDIS_HOST | |
? { host: REDIS_HOST, port: 6379 } | |
: { host: "localhost", port: 6379 }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BUCKET_NAME="bucket_name_here" # "stratzy-logs" | |
FILE_UPLOAD_LOCATION="directory_name_inside_bucket" # "system" | |
FILE_TO_UPLOAD_LOCATION= "local_directory" #"/home/ec2-user/.pm2/logs/" | |
# Using loop | |
# for FILE in $FILE_TO_UPLOAD_LOCATION | |
# do | |
# filename=$(basename $FILE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Redis Client file | |
// const redis = require("redis"); | |
// const { REDIS_HOST } = process.env; | |
// module.exports = () => { | |
// if (REDIS_HOST) | |
// return redis.createClient({ | |
// url: `redis://${REDIS_HOST}:6379` | |
// }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let array = [1,2,3,4,5,6,7,8,9,10,11,12,13]; | |
const arrayToChunks = (arr, chunkSize) => { | |
let i, | |
j, | |
chunks = []; | |
for (i = 0, j = arr.length; i < j; i += chunkSize) { | |
chunks.push(arr.slice(i, i + chunkSize)); | |
} |
Basically we have 5 Major type of styling solution available on which most of the component ui frameworks and styling libraries are based upon.
- Plain CSS - This is the regular way of using pure CSS for styling with no external dependencies and we can either write inline(JSS), internal(head section) or external css(css file).
- SASS/LESS - CSS preprocessor is basically a scripting language that extends CSS and then compiles it into regular CSS.
- JSS - JSS is an authoring tool for CSS which allows you to use JavaScript to describe styles in a declarative, conflict-free and reusable way. It can compile in the browser, server-side or at build time in Node. JSS is framework agnostic. Eg: Material-ui uses JSS at its core.
- Styled-components - This is an easy to use styling solution that uses tagged template literals (a recent addition to JavaScript) and the power of CSS, styled-components allows you to write actual CSS code to style your components.
- CSS Modules - A C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component, lazy, Suspense } from 'react'; | |
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'; | |
import Login from './Components/Login/Login'; | |
import Phone from './Components/Login/Phone'; | |
import ScrollToTop from './ScrollToTop'; | |
import axios from 'axios'; | |
import { StylesProvider } from '@material-ui/core/styles'; | |
import { PageView, initGA } from './Tracking'; | |
import { CircularProgress } from '@material-ui/core'; | |
import './index.css'; |
NewerOlder