- start in Kibana root (shown as "{root}/" throughout below)
yarn build -> scripts.build -> node scripts/build --all-platforms
- build script requires
'{root}/src/dev/build/cli'
- the cli file manages a bunch of initial CLI flags, then calls
buildDistributables()
buildDistributables
runs many build tasks, including theOptimizeBuildTask
- the optimize task runs the kibana binary with the optimize flag:
{root}/bin/kibana --env.name=production --logging.json=false --optimize
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
// Assumes that your script is somewhere within a folder called "adobe_scripts" and | |
// that you store your includable files relative to `adobe_scripts/lib/` | |
// indexOf polyfill from https://gist.github.com/atk/1034425 | |
[].indexOf||(Array.prototype.indexOf=function(a,b,c){for(c=this.length,b=(c+~~b)%c;b<c&&(!(b in this)||this[b]!==a);b++);return b^c?b:-1;}); | |
var Libraries = (function (libPath) { | |
return { | |
include: function (path) { | |
if (!path.match(/\.jsx$/i)) { |
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
type Neverize<T, U> = { [P in Exclude<keyof T, keyof U>]?: never }; | |
type ExclusiveOr<T, U> = (T | U) extends object | |
? (Neverize<T, U> & U) | (Neverize<U, T> & T) | |
: T | U; | |
interface S { | |
value: string; | |
string: string; | |
} |
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
/** | |
* flattens an object into a single dimension with dot-separated key paths | |
* | |
* e.g. | |
* const test = { a: 'hello', b: { xx: 'cool', yy: 'yeah' }, c: [1, 2] } | |
* flatten(test) => { 'a': 'hello', 'b.xx': 'cool', 'b.yy': 'yeah', 'c.0': 1, 'c.1': 2 } | |
*/ | |
function flatten(o, path = []) { | |
return Object.entries(o).reduce((result, [key, value]) => { | |
const localPath = [...path, key]; |
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
// file1a.js | |
const CoolName = () => 'cool' | |
export { CoolName } | |
// file2a.js | |
import { CoolName } from './file1a' | |
console.log(CoolName.name) // -> "CoolName" | |
/** |
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
#!/bin/sh | |
# | |
# Suggested name for this script: git-clean-stale-branches | |
# | |
# This script will help to remove "stale" branches from a remote | |
# repository (by default the "origin" repository). Stale branches | |
# are any branches that does not exist in the local repository. | |
# | |
# This script should be run in the local repository. It will print | |
# out a git command to remove all branches from the remote repository |
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 captureSuccess = (result) => ({ state: 'succeeded', result }) | |
const captureFail = (error) => ({ state: 'rejected', error }) | |
module.exports.allSettled = (promises, { only }) => { | |
const settled = Promise.all(promises.map((p) => p.then(captureSuccess).catch(captureFail))) | |
return only | |
? settled.then((results) => results.filter((r) => r.state === only).map((r) => r.result)) | |
: settled | |
} |
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
// these examples use thunks but the problem applies to most other redux async strategies | |
// action creator 1: get user | |
const getUser = async (id) => (dispatch) => { | |
dispatch({ type: 'GET_USER_PENDING', payload: id }) | |
try { | |
const result = await doAsyncThing(id) | |
return dispatch({ type: 'GET_USER_SUCCESS', payload: result }) | |
} catch (error) { | |
return dispatch({ type: 'GET_USER_FAILED', payload: error }) |
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
// higher order component creator | |
const withFun = (Component) => (props) => <Component {...props} fun='Injected Secret Value' /> | |
// using the higher order component (with this pattern, you have to create a component, THEN wrap it in the HOC creator function) | |
const _MyComponent = (props) => <div><h1>{props.fun}</h1></div> | |
const MyComponent = withFun(_MyComponent) | |
// "render prop" using children |
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
<?php | |
class A | |
{ | |
public static $var = "I'm set in A!<br>"; | |
public static function getStatic() { | |
echo static::$var; | |
} | |
public static function getSelf() { |