ββββββ
ββββββ
#JavaScript #computerScience
Please open Telegram to view this post
VIEW IN TELEGRAM
π13β€5
We will learn about the security concerns for each layer in the next post. Stay tuned!
ββββββ
ββββββ
#network
Please open Telegram to view this post
VIEW IN TELEGRAM
π6β€5π3π€―1
Physical Layer: Sniffing
Data Link Layer: Spoofing
Network Layer: Man-in-the-Middle (MITM)
Transport Layer: Reconnaissance
Session Layer: Hijacking
Presentation Layer: Phishing
Application Layer: Exploit
We will learn how we can prevent our website from some of these attacks in future posts!
ββββββ
ββββββ
#network #security
Please open Telegram to view this post
VIEW IN TELEGRAM
β€11π4
const counter = new Signal.State(0);
// Read the value of Signal
console.log(counter.get()); // Output: 0
// Change the value of Signal
counter.set(1);
console.log(counter.get()); // Output: 1
ref in VueJS, understanding Signals should pose no challenge.ββββββ
ββββββ
#JavaScript #EcmaScript
Please open Telegram to view this post
VIEW IN TELEGRAM
π8β€4π€―2
β¨ Software Engineering Quote
π¬ In software development, βperfectβ is a verb, not an adjective. There is no perfect process. There is no perfect design. There are no perfect stories. You can, however, perfect your process, your design, and your stories.
π£ Kent Beck
ββββββ
#Agile #softwareEngineering
π₯ Follow @devDastan for more content.
ββββββ
#Agile #softwareEngineering
Please open Telegram to view this post
VIEW IN TELEGRAM
π8β€7π€―2
function Car() {
this.make = 'Lamborghini';
return { make: 'Maserati' };
}
const myCar = new Car();
console.log(myCar.make);ββββββ
#JavaScript #Quiz
Please open Telegram to view this post
VIEW IN TELEGRAM
π€―10π9β€4
Promise.all and Promise.allSettled are two methods provided by JavaScript's Promise API, but they have different behaviors and use cases.Waits for all promises to resolve or rejects immediately if any promise rejects. Resolves with an array of resolved values.
Waits for all promises to settle (resolve or reject) and always resolves. Returns an array of objects representing the outcomes of the promises, including their status and value/reason.
ββββββ
ββββββ
#JavaScript
Please open Telegram to view this post
VIEW IN TELEGRAM
β€8π3
ββββββ
ββββββ
#systemDesign #api
Please open Telegram to view this post
VIEW IN TELEGRAM
β€9π5
Build complex string types using dynamic expressions within backticks.
type Endpoint = `/users/${number}`;
const validEndpoint: Endpoint = '/users/123';
// const invalidEndpoint: Endpoint = '/posts/456'; // Error: Type '"/posts/456"' is not assignable to type 'Endpoint'
representing API responses, URL patterns, or validation formats.
ββββββ
#TypeScript
Please open Telegram to view this post
VIEW IN TELEGRAM
π7β€3
num?const num = parseInt('7*6', 10);For example, in "78", only "7" is valid, so it parses it into the decimal 7, ignoring the "" and "8". Thus, num now equals 7.
ββββββ
#JavaScript #Quiz
Please open Telegram to view this post
VIEW IN TELEGRAM
π8π€―5
import { useState } from 'react';
function Counter() {
const [count, setCount] = useState(0);
return (
<div>
<p>You clicked {count} times</p>
<button onClick={() => setCount(count + 1)}>Click me</button>
</div>
);
}import { useRef } from 'react';
function InputFocus() {
const inputRef = useRef(null);
function handleFocus() {
inputRef.current.focus();
}
return (
<div>
<input ref={inputRef} />
<button onClick={handleFocus}>Focus Input</button>
</div>
);
}- State is immutable
- Avoid reading/writing refs during rendering
- Both persist data and have different update behaviors
ββββββ
ββββββ
#JavaScript #ReactJS
Please open Telegram to view this post
VIEW IN TELEGRAM
π11π1
Utilize functions that take and return types, enabling powerful abstractions like generic type predicates and type builders.
type IsStringLiteral<T> = T extends string ? true : false;
function logIfString<T>(value: T): T extends string ? void : T {
if (IsStringLiteral<T>) {
console.log(value);
}
return value;
}
Creating dynamic component that have multiple states and behaviors.
ββββββ
#TypeScript
Please open Telegram to view this post
VIEW IN TELEGRAM
π6β€3
const user = {
email: "[email protected]",
updateEmail: email => {
this.email = email;
}
}
user.updateEmail("[email protected]")
console.log(user.email)[email protected][email protected]ββββββ
#JavaScript #Quiz
Please open Telegram to view this post
VIEW IN TELEGRAM
π9π€―5β€4
β¨ Software Engineering Quote
π¬ Programs must be written with the idea that they will be read by people, and only incidentally for machines to execute.
π£ Harold Abelson
ββββββ
#Agile #softwareEngineering
π₯ Follow @devDastan for more content.
ββββββ
#Agile #softwareEngineering
Please open Telegram to view this post
VIEW IN TELEGRAM
β€9π5
/* Child combinator: selects direct children of an element */
.parent > .child {
color: red;
}
.faq-item:nth-of-type(odd) .faq-question{
background-color: #fff; /* For odd items
*/
} .faq-item:first-of-type .faq-question {
border-top: 2px solid #007BFF;
}:first-letter, ::first-line):/* ::after used to display "+" symbol */
.faq-question::after {
content: '+';
color: #00ad8f;
font-size: 1.4em;
}
.faq-item[data-category^="important"] .faq-question {
color: #E91E63;
}ββββββ
ββββββ
#css
Please open Telegram to view this post
VIEW IN TELEGRAM
π6π€―3β€2π1
Shape types based on conditions, creating dynamic type hierarchies. For example, defining a type thatβs an
object with specific properties depending on a provided string value.
type Config = {
type: 'basic' | 'advanced';
};
type BasicConfig = Config & { type: 'basic' };
type AdvancedConfig = Config & { type: 'advanced' };
function configure(config: Config): void {
if (config.type === 'basic') {
console.log('Applying basic configuration');
} else {
console.log('Applying advanced configuration');
}
}Useful for strategy patterns and implementing high-level business logic.
ββββββ
#TypeScript
Please open Telegram to view this post
VIEW IN TELEGRAM
π8β€5π€―2π1
πΈ Involve all stakeholders in mapping security risks and protections.
πΈ Develop a strong security culture affecting daily procedures and offerings.
πΈ Validate incoming data at each application stage.
πΈ Use libraries like dom-purify for quicker security implementation.
πΈ Refer to OWASP cheat sheet series for input/output sanitization.
πΈ Use Software Composition Analysis (SCA) for third-party library security.
πΈ Implement Content-Security-Policy (CSP) for front-end security.
We will learn more about the tools we can use to check our website's security!
ββββββ
ββββββ
#network #security
Please open Telegram to view this post
VIEW IN TELEGRAM
π11β€3
ββββββ
ββββββ
#softwareEngineering #softSkill
Please open Telegram to view this post
VIEW IN TELEGRAM
π11β€2π1
β¨ Software Engineering Quote
π¬ Code is like humor. When you have to explain it, itβs bad.
π£ Cory House
ββββββ
#softwareEngineering #programming
π₯ Follow @devDastan for more content.
ββββββ
#softwareEngineering #programming
Please open Telegram to view this post
VIEW IN TELEGRAM
π12π€―1π1
πΊ Code Review Pyramid
β€ Read Previous Parts: [Code Review Best Practices]
π£οΈ Each layer of Code Review Pyramid is a characteristic to which the reviewed code must conform.
The bottom layer is the correctness of the code, which is of prime importance.
1οΈβ£ Code Style
π’ Consistent naming and formatting.
π Avoid duplication and unused imports.
π’ Use automatic code formatting tools.
2οΈβ£ Tests
π’ Review test cases for coverage.
π Automate testing using plugins.
3οΈβ£ Documentation
π’ Keep documentation comprehensive and up-to-date.
4οΈβ£ Implementation Semantics
π’ Ensure code meets requirements, is efficient, and secure.
π Check for error handling, resource management, concurrency, and third-party libraries.
π’ Avoid code smells and anti-patterns.
5οΈβ£ API Semantics
π’ Ensure API design follows best practices and provides a clear interface.
π Check for consistency, versioning, error messages, pagination, filtering, and performance.
π’ Ensure no internal logic leakage, no breaking of existing API, and proper authentication/authorization.
β οΈ Code review shouldnβt proceed to upper layers until the bottom layer, correctness, gets approved.
ββββββ
π Article: [here]
π₯³ Medium Article: [here]
ββββββ
#softwareEngineering #softSkill
π₯ Follow @devDastan for more content.
The bottom layer is the correctness of the code, which is of prime importance.
ββββββ
ββββββ
#softwareEngineering #softSkill
Please open Telegram to view this post
VIEW IN TELEGRAM
π8β€4π€―2
const box = { x: 10, y: 20 };
Object.freeze(box);
const shape = box;
shape.x = 100;
console.log(shape);
ReferenceErrorObject.freeze prevents adding, removing, or modifying properties of an object (unless the propertyβs value is another object).
When we create the variable shape and set it equal to the frozen object box, shape also refers to a frozen object. You can check if an object is frozen using Object.isFrozen. In this case, Object.isFrozen(shape) returns true.
Since shape is frozen and x is not an object, we cannot modify x. Therefore, x remains 10, and { x: 10, y: 20 } gets logged.
ββββββ
#JavaScript #Quiz
Please open Telegram to view this post
VIEW IN TELEGRAM
π16π2π€―1