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
| // Price Format | |
| function formatNum(num){ | |
| var num = num + '', | |
| arr = num.split(''), | |
| arrCopy = arr.slice(0), | |
| j = 0; | |
| for(var i = arr.length -1 ; i >= 0; i--){ | |
| if ( j % 3 === 0 && j !== 0 ) { | |
| arrCopy.splice( i + 1, 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
| class Observer { | |
| subscribe(subscriber) { | |
| this.subscribers.push(subscriber); | |
| } | |
| publish(event, data) { | |
| let query = this.subscribers.filter(subscriber => subscriber.event === event); | |
| if (query.length) query.forEach(subscriber => subscriber.action(data)); | |
| } | |
| constructor() { | |
| this.subscribers = []; |
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
| body { | |
| -webkit-overflow-scrolling: touch; | |
| } |
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
| // Remove default genesis sidebars | |
| remove_action( 'genesis_after_content', 'genesis_get_sidebar' ); | |
| remove_action( 'genesis_after_content_sidebar_wrap', 'genesis_get_sidebar_alt'); |
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 formEl = document.querySelector('.form-profile-upd'); | |
| formEl.addEventListener('submit', e => { | |
| e.preventDefault(); | |
| const data = new FormData(formEl); | |
| const id = window.WP_DATA.USER_ID; | |
| console.log(data.get('birthday')); | |
| fetch(`${WP_DATA.ROOT_URL}wp/v2/users/` + id, { | |
| method: 'POST', | |
| credentials: 'same-origin', | |
| body: { |
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 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); |
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
| //==== 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 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
| 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 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
| 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 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
| @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 + '-'); |