Skip to content

Instantly share code, notes, and snippets.

View Kamilnaja's full-sized avatar
💭
🐍🔥

Kamil Naja Kamilnaja

💭
🐍🔥
View GitHub Profile
Struktura klasy
@ViewChild, @ViewChildren, ContentChild
@Inputy @Outputy
readonly observable$, subject
pola publiczne
pola prywatne
constructor()
@Kamilnaja
Kamilnaja / typescript
Last active November 18, 2023 12:11
Angular testing
import { HttpClientTestingModule } from '@angular/common/http/testing';
import {
ComponentFixture,
TestBed,
fakeAsync,
flush,
} from '@angular/core/testing';
import { ReactiveFormsModule } from '@angular/forms';
import { MockPipe, MockProvider } from 'ng-mocks';
import { BehaviorSubject, take } from 'rxjs';
import { it } from '@jest/globals';
import { divide } from './it.each';
describe('it.each', () => {
it.each([
[1, 2, '0.5'],
[12, 3, '4'],
[1, 4, '0.25'],
[4, 0, ''],
])(
@Kamilnaja
Kamilnaja / code.js
Created August 5, 2023 16:58
Simplify me
function dayOfTheWeek(num) {
switch (num) {
case 1:
return 'Monday';
case 2:
return 'Tuesday';
case 3:
return 'Wednesday';
case 4:
return 'Thursday';
@Kamilnaja
Kamilnaja / js
Created August 5, 2023 16:23
Check if exists
function check(id) {
if () { // check if this value exists
return
}
console.log(id);
}
export interface AuthInfo {
isLoggedIn: boolean;
}
import { Component, OnDestroy, OnInit } from '@angular/core';
import { FormControl } from '@angular/forms';
import { debounceTime, Subject, takeUntil } from 'rxjs';
import { FoodService } from './food.service';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
})
import {
CdkDragDrop,
moveItemInArray,
transferArrayItem,
} from '@angular/cdk/drag-drop';
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-drag-and-drop',
template: `
// 1
const date = new Date(Date.UTC(2020, 11, 20, 3, 23, 16, 738));
console.log(new Intl.DateTimeFormat('pl-PL', {dateStyle: 'full'}).format(date));
// niedziela, 20 grudnia 2020
// 2
const vehicles = ['Motor', 'bus', 'samochód'];
const formatter = new Intl.ListFormat('pl', { style: 'long', type: 'conjunction' });
console.log(formatter.format(vehicles));
// Motor, bus i samochód
"window.titleBarStyle": "native" - focus on navbar on alt
smooth scroll
smooth caret