Skip to content

Instantly share code, notes, and snippets.

View d4ins's full-sized avatar
🤌
Coding...

Andrii Drozdov d4ins

🤌
Coding...
  • OX
  • Dublin, Ireland
View GitHub Profile
@d4ins
d4ins / transfer.ts
Created March 26, 2023 04:01
10 Ways How ChatGPT Can Make Developers' Life Easier | Code transfer
import { Component, useState } from '@angular/core';
@Component({
selector: 'app-root',
template: <div class='App'> Counter: {{ counter }} <br /> <app-button (click)="onClick()"></app-button> </div> ,
styles: []
})
export class AppComponent {
counter = 0;
@d4ins
d4ins / review.js
Created March 26, 2023 03:52
10 Ways How ChatGPT Can Make Developers' Life Easier | Code review
import React, { useState } from 'react';
function Button(props) {
return <button onClick={props.onClick}>Click me</button>
}
export function App(prps) {
const [counter, setCounter] = useState(0);
const onClick = () => {setCounter(counter + 1 )}
@d4ins
d4ins / jsonstringify.js
Created March 26, 2023 03:37
10 Ways How ChatGPT Can Make Developers' Life Easier | Compare two objects
function objectsEqual(a, b) {
return JSON.stringify(a) === JSON.stringify(b);
}
@d4ins
d4ins / mistake.js
Created February 12, 2023 11:22
10 Ways How ChatGPT Can Make Developers Life Easier | Automatic Test coverage | mistake.js
const numbers = [1,2,3,4,5,6];
function findOdd(nums) {
nums % 2
}
@d4ins
d4ins / classWithComments.ts
Created February 12, 2023 11:14
10 Ways How ChatGPT Can Make Developers Life Easier | Automatic Test coverage | classWithComments.ts
export class _Core {
// static property to store instance of the _Core class
private static _instance?: _Core;
// private property to store an instance of the _Interfaces.Messaging class
private readonly messaging: _Interfaces.Messaging;
// constructor to create an instance of the class and initialize messaging property
constructor() {
this.messaging = FirebaseMessaging.default();
@d4ins
d4ins / SignInScreen.tsx
Created February 12, 2023 11:06
10 Ways How ChatGPT Can Make Developers Life Easier | Automatic Test coverage | SignInScreen.tsx
import React, { useState } from 'react';
import { View, TextInput, Button, StyleSheet } from 'react-native';
const SignInScreen = () => {
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
const handleSignIn = () => {
// Sign in logic here
console.log(email, password);
@d4ins
d4ins / tests.ts
Created February 12, 2023 09:58
10 Ways How ChatGPT Can Make Developers Life Easier | Automatic Test coverage | tests.ts
import { _Core, _Interfaces } from './_Core';
describe('_Core', () => {
const mockMessaging = {
registerDeviceForRemoteMessages: jest.fn(() => Promise.resolve()),
getToken: jest.fn(() => Promise.resolve('mockToken')),
requestPermission: jest.fn(() => Promise.resolve(_Interfaces.AuthorizationStatus.AUTHORIZED)),
};
beforeEach(() => {
@d4ins
d4ins / class.ts
Last active February 12, 2023 09:56
10 Ways How ChatGPT Can Make Developers Life Easier | Automatic Test coverage | class.ts
export class _Core {
private static _instance?: _Core;
private readonly messaging: _Interfaces.Messaging;
constructor() {
this.messaging = FirebaseMessaging.default();
}
public static get instance(): _Core {
@d4ins
d4ins / object.ts
Created February 11, 2023 09:38
2 Ways to Implement Prototype Pattern in JavaScript | Class implementation | object.ts
const prototype: Prototype = {
greeting: "Hello!",
greet: function() {
console.log(this.greeting);
},
clone: function() {
return Object.create(this);
},
@d4ins
d4ins / types.ts
Created February 11, 2023 09:36
2 Ways to Implement Prototype Pattern in JavaScript | Class implementation | types.ts
interface Prototype {
greeting: string;
greet: () => void;
clone: () => Prototype;
}