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
{ | |
"final_space": true, | |
"console_title": true, | |
"console_title_style": "folder", | |
"blocks": [ | |
{ | |
"type": "prompt", | |
"alignment": "left", | |
"horizontal_offset": 0, | |
"vertical_offset": 0, |
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
// before starting: npm i -D ngx-wallaby-jest | |
const ngxWallabyJest = require('ngx-wallaby-jest'); | |
module.exports = function(wallaby) { | |
return { | |
files: [ | |
'src/**/*.+(ts|html|json|snap|css|less|sass|scss|jpg|jpeg|gif|png|svg)', | |
'tsconfig.json', | |
'jest.config.js', | |
'tsconfig.spec.json', |
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 collectionSum = (collection) => { | |
const iterator = collection.iterator(); | |
let eachIteration; | |
let sum = 0; | |
while ((eachIteration = iterator(), !eachIteration.done)) { | |
sum += eachIteration.value; | |
} | |
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
<div *ngIf="product$ | async as products"> | |
<ul> | |
<li *ngFor="let product of products"> | |
{{ product.name }} | |
</li> | |
</ul> | |
</div> |
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
function deepFreeze(value) { | |
if (Array.isArray(value)) { | |
for (const element of value) { | |
deepFreeze(element); | |
} | |
Object.freeze(value); | |
} else if (typeof value === 'object' && value !== null) { | |
for (const v of Object.values(value)) { | |
deepFreeze(v); | |
} |
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 { Pipe, PipeTransform } from '@angular/core'; | |
/* | |
* Strips HTML | |
* Takes an input parameter HTML. | |
* Usage: | |
* content | striphtml | |
* Example: | |
* <p [innerHTML]="content | striphtml"></p> | |
*/ | |
@Pipe({ |
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 union = ( set1, set2 ) => { | |
return new Set([...set1, ...set2]); | |
} | |
let first = [1, 3, 1, 5, 7, 3, 9, 12, 15]; | |
let second = [1, 20, 18, 5, 10, 3, 16]; | |
union(first, second); /*? */ | |
let intersection = (set1, set2) => { |
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 map = (fn, arr) => arr.reduce((acc, item) => { | |
return acc.concat(fn(item)); | |
}, []); | |
const myArray = [2, 4, 6, 8]; | |
const reduceFn = item => item * 2; | |
const myReducer = map(reduceFn, myArray); |
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 calls = ""; | |
function jerry(str) { | |
kramer('Jerry'); | |
} | |
function george(str) { | |
calls = str + 'George'; | |
elaine(calls); | |
} |
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
function add(a, b) { | |
return a + b; | |
} | |
function sub(a, b) { | |
return a - b; | |
} | |
function mul(a, b) { | |
return a * b; |