Skip to content

Instantly share code, notes, and snippets.

View vvatikiotis's full-sized avatar

Bill Vatikiotis vvatikiotis

View GitHub Profile
@vvatikiotis
vvatikiotis / list.md
Created December 1, 2023 06:56 — forked from ih2502mk/list.md
Quantopian Lectures Saved
<html>
<body>
<div id="root"></div>
<script src="https://unpkg.com/react@16.13.1/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16.13.1/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/@babel/standalone@7.8.3/babel.js"></script>
<script type="text/babel">
ReactDOM.render(<div>Hello World</div>, document.getElementById('root'))
</script>
</body>
@vvatikiotis
vvatikiotis / js-array-times.js
Last active April 26, 2020 19:05
JS Array times
Array.from(Array(3)).forEach((x, i) => {
something();
});
Array.from({ length: 3 }, (x, i) => {
something();
});
Array(5).fill().map(()=>{
// Do this 5 times:
const bypass = [
// function names to avoid logging
];
const collapsed = [
// function names to groupCollapsed
];
module.exports = function(babel) {
const { types: t } = babel;
const wrapFunctionBody = babel.template(`{
@vvatikiotis
vvatikiotis / HTML5 Selection
Last active April 26, 2020 18:59 — forked from AvraamMavridis/gist:5c097b76ae3c3fbf33706787fe31aa2b
Browser selection problem
/*
Comments
========
*---* [Jane Smith] Hey [Rob], what do you think about
| | switching the roll-out plan over to a faster schedule?
*---*
{{{ I guess my concern is that we won't learn fast
enough, and that will put the project... [See More]
// Monkey patch Array.prototype
Object.assign(Array.prototype, {
unique() {
return this.filter((value, index, array) => {
return array.indexOf(value) === index;
});
}
});
@vvatikiotis
vvatikiotis / LiquidationPreferences.md
Created January 8, 2019 08:11
Coding Challenge: Liquidation Preferences

Coding Challenge: Waterfall Analysis

When a startup closes a new financing round (called a Series A, B, C, and so on), a new share class with preferred rights is usually created. These protect new investors in case the company gets sold at a lower valuation than the current financing round (while founders and employees might still get a pretty nice return). They are called liquidation preferences. When the company is sold (called an “exit”), the money of the exit has to be divided among all shareholders according to these liquidation preferences.

The basic rules are:

1× non-participating

The investor gets paid back 1× their originally invested amount, nothing else. The rest is divided among all the other shareholders according to their ownership in the company (this is called “pro-rata”).

@vvatikiotis
vvatikiotis / index.md
Created October 22, 2018 18:35 — forked from bvaughn/index.md
How to use profiling in production mode for react-dom
@vvatikiotis
vvatikiotis / Cancellable.js
Last active October 2, 2018 12:42
Cancellable promise helper
// https://github.com/mehiel/router/blob/58c7aa4d0be87b6c4aad9643f168058f42eafcd7/src/lib/utils.js#L261
// makeCancelable as in https://reactjs.org/blog/2015/12/16/ismounted-antipattern.html
const makeCancelable = promise => {
let hasCanceled_ = false;
const wrappedPromise = new Promise((resolve, reject) => {
promise.then(
val => (hasCanceled_ ? reject({ isCanceled: true }) : resolve(val)),
error => (hasCanceled_ ? reject({ isCanceled: true }) : reject(error))
);
});
// This is an example of how to fetch external data in response to updated props,
// If you are using an async mechanism that does not support cancellation (e.g. a Promise).
class ExampleComponent extends React.Component {
_currentId = null;
state = {
externalData: null
};