This file contains hidden or 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 fs = require('fs'); | |
let rawData = fs.readFileSync('data.json'); | |
let data = JSON.parse(rawData); | |
const convertToNumber = item => { | |
item.workTimeRangeSum = Number(item.workTimeRangeSum.split(':').join('.').replace(/\.3/g, '.5')); | |
return item; | |
} | |
const res = data.workDays | |
.map(item => { |
This file contains hidden or 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
"window.titleBarStyle": "native" - focus on navbar on alt | |
smooth scroll | |
smooth caret |
This file contains hidden or 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
// 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 |
This file contains hidden or 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 { | |
CdkDragDrop, | |
moveItemInArray, | |
transferArrayItem, | |
} from '@angular/cdk/drag-drop'; | |
import { Component, OnInit } from '@angular/core'; | |
@Component({ | |
selector: 'app-drag-and-drop', | |
template: ` |
This file contains hidden or 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 { 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'], | |
}) |
This file contains hidden or 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
export interface AuthInfo { | |
isLoggedIn: boolean; | |
} |
This file contains hidden or 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
function check(id) { | |
if () { // check if this value exists | |
return | |
} | |
console.log(id); | |
} |
This file contains hidden or 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
function dayOfTheWeek(num) { | |
switch (num) { | |
case 1: | |
return 'Monday'; | |
case 2: | |
return 'Tuesday'; | |
case 3: | |
return 'Wednesday'; | |
case 4: | |
return 'Thursday'; |
This file contains hidden or 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 { 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, ''], | |
])( |
This file contains hidden or 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 { 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'; |