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
export class ViewState<T extends object> extends BehaviorSubject<T> { | |
constructor(initialState: T) { | |
super(initialState); | |
} | |
patch(newState: Partial<T>) { | |
this.next({ | |
...this.value, | |
...newState | |
}); |
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
export function enterZone(zone: NgZone) { | |
return <T>(source: Observable<T>) => | |
new Observable<T>(observer => | |
source.subscribe({ | |
next: (x) => zone.run(() => observer.next(x)), | |
error: (err) => observer.error(err), | |
complete: () => observer.complete() | |
}) | |
); | |
} |
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 printElem(selector, width, height) { | |
const newWindow = window.open('', 'PRINT', `height=${height},width=${width}`); | |
const element = document.querySelector(selector); | |
newWindow.document.write(` | |
<html> | |
<head> | |
<title>${document.title}</title> | |
</head> | |
<body>${element.innerHTML}</body> | |
</html>`); |
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
{ | |
"liveSassCompile.settings": { | |
"generateMap": false, | |
"includeItems": [ | |
"./scss/style.scss" | |
], | |
"formats":[ | |
{ | |
"format": "expanded", | |
"extensionName": ".css", |
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 path = require('path'); | |
const fs = require('fs'); | |
const APP_MODULES_DIR = 'projects/evo-ui-kit/src/lib/modules'; | |
const APP_COMPONENTS_DIR = 'projects/evo-ui-kit/src/lib/components'; | |
const pascalize = (str) => { | |
return str | |
.replace(/\s(.)/g, (s) => s.toUpperCase() ) | |
.replace(/-(.)/g, (s) => s.toUpperCase() ) | |
.replace(/\s/g, '') |
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
@mixin gridColumnSizes($params) { | |
$defaults: ( | |
suffix: '', | |
base: '' | |
); | |
$opts: map-merge($defaults, $params); | |
$base: map-get($opts, 'base'); | |
$suffix: map-get($opts, 'suffix'); | |
$bs: if($base == '', '', $base + '__'); | |
$sf: if($suffix == '', '_', '_' + $suffix + '-'); |
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
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl'; | |
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl'); | |
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl'); | |
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl'); |
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
private handleConfirmationSuccess(methodId: string) { | |
this.paymentsService.pollPaymentMethodCreated(methodId).pipe( | |
mergeMap(methodId => this.paymentsService.setDefaultPaymentMethod(methodId)), | |
mergeMap(methodId => forkJoin(of(methodId), this.paymentsService.fetchPaymentMethods())), | |
tap((data) => { | |
const id = data[0]; | |
this.paymentsService.paymentMethods.defaultMethod = this.paymentsService.paymentMethods.getPaymentMethod(id); | |
this.routerDataStorage.set({ paymentMethodCreated: PaymentGatewayTypes.CARD }); | |
this.router.navigate(['../../../'], { | |
relativeTo: this.route, |
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
//==== User ====// | |
createUser(body, scenario = 'preliminary') { | |
return window.fetch(`${API_DOMAIN}user/create?access-token=${API_TOKEN}&scenario=${scenario}`, { | |
method: 'POST', | |
headers: new Headers({ 'Content-Type': 'application/json' }), | |
body: JSON.stringify(body) | |
}) | |
.then(res => res.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 some = {a: { bc: { de: 'hello'}}}; | |
const path = 'a.bc.de'; | |
let result = Object.assign({}, some); | |
path.split('.').forEach( part => { | |
console.log(result); | |
result = result[part]; | |
}); | |
console.log(result); |
NewerOlder