Skip to content

Instantly share code, notes, and snippets.

View gaevoy's full-sized avatar

Volodymyr Gaevoy gaevoy

View GitHub Profile
@jennasalau
jennasalau / Self-XSS-Warning.js
Created May 31, 2018 23:31
Social Engineering Self-XSS Warning Like Facebook
if (process.env.NODE_ENV === 'production') {
if (typeof window !== 'undefined' && typeof console === 'object' && typeof console.log === 'function') { // eslint-disable-line no-console
console.log('%cWARNING!', 'color:white; background:red; font-size: 16pt'); // eslint-disable-line no-console
console.log('%cThis is a browser feature intended for developers. Using this console may allow attackers to impersonate you and steal your information. Do not enter or paste code that you do not understand.', 'font-size: 14pt'); // eslint-disable-line no-console
}
}
@addyosmani
addyosmani / notes.md
Last active August 10, 2022 03:59
Notes on streaming JS & long-term code compilation caching in Chrome

Re: http://blog.chromium.org/2015/03/new-javascript-techniques-for-rapid.html

V8 Optimisations to enable fast page startup

As mentioned in our Chromium blog post, Chrome 41 introduces support for streaming parsing of JavaScript files using the async or defer attributes. This is where the V8 parser will parse any incoming JavaScript piece-by-piece so the compiler can immediately begin compiling the AST when script loading has completed. This lets us do something useful while waiting for the page to load. Compare:

This means parsing can be removed from the critical path when loading up the page. In these cases such scripts are parsed on a separate thread as soon as the download begins, allowing parsing to complete very soon after the download has completed (milliseconds), leading to pages (potentially) loading much faster.

@abdullin
abdullin / ddd-in-golang.markdown
Last active October 10, 2023 00:46
DDD in golang

This is my response to an email asking about Domain-Driven Design in golang project.

Thank you for getting in touch. Below you will find my thoughts on how golang works with DDD, changing it. This is merely a perception of how things worked out for us in a single project.

That project has a relatively well-known domain. My colleagues on this project are very knowledgeable, thoughtful and invested in quality design. The story spelled out below is a result of countless hours spent discussing and refining the approach.

Conclusions could be very different, if there was a different project, team or a story-teller.

Short story