Skip to content

Instantly share code, notes, and snippets.

View dobromir-hristov's full-sized avatar
💭
Flexing code and coding muscles

Dobromir Hristov dobromir-hristov

💭
Flexing code and coding muscles
View GitHub Profile
@dobromir-hristov
dobromir-hristov / iterate.js
Created November 2, 2018 08:09
Sequental iterate + screenshot
async function main(){
const response = await getJson('sone/endpoint') // vzimame vsi4ko
const finalResult = await response.reduce((promiseChain, currentItem) => {
return promiseChain.then(results => {
return screenShotAndCompare(currentItem)
})
}, Promise.resolve())
// Tuk ve4e sme gotovi
@dobromir-hristov
dobromir-hristov / PusherService.js
Created May 4, 2018 13:35
Busting SPA chunk cache for active users after a deploy
import Pusher from 'pusher-js'
Pusher.logToConsole = process.env.NODE_ENV === 'development'
export const PusherService = new Pusher(process.env.PUSHER_KEY, {
cluster: 'eu',
encrypted: true
})
@dobromir-hristov
dobromir-hristov / object-array-to-br-string.js
Last active July 20, 2017 12:27
Transform Objects and Arrays to String with breaks.
/**
* Transform an array of messages from laravel error message bag to be a single html string with breaks
* @param {Object | Array | String} message
* @example
* message = { username: ['some error', 'maybe another error'], email: ['another error', 'and another error']}
* message = { username: 'some error', email: 'and another error'}
* message = ['some error', 'and another error']
* message = [['some error'], ['and another error']]
* message = 'some error'
* @return { String }