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
# from https://gist.github.com/jcheng5/6141ea7066e62cafb31c | |
# Returns a reactive that debounces the given expression by the given time in | |
# milliseconds. | |
# | |
# This is not a true debounce in that it will not prevent \code{expr} from being | |
# called many times (in fact it may be called more times than usual), but | |
# rather, the reactive invalidation signal that is produced by expr is debounced | |
# instead. This means that this function should be used when \code{expr} is | |
# cheap but the things it will trigger (outputs and reactives that use | |
# \code{expr}) are expensive. |
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
def curry(func): | |
def f(*args): | |
outerArgs = args | |
next = lambda *args : f(*args, *outerArgs) | |
next.value = lambda: func(args) | |
return next | |
return f | |
add = curry(sum) |
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
/** | |
* Serialise input as key-value pair string, eg. for human-readable logs. | |
* | |
* @param {any} body | |
* @param {number} nest | |
* @param {string} delimiter | |
* @param {string} arrayDelimiter | |
* @param {boolean} nested | |
* @returns {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
import {Directive, EventEmitter, Output} from '@angular/core'; | |
import {AgGridNg2} from 'ag-grid-angular'; | |
import {GridApi} from 'ag-grid'; | |
/*** | |
* Range selection directive which selects & highlights rows for any selected cell | |
* (ctrl+click for multiple ranges) and emits a 'rangeSelectionRowsChanged' with a | |
* rows property of selected rows. | |
* | |
* NOTE: this only currently supports client-side grids. |
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
import dash | |
import dash_core_components as dcc | |
import dash_html_components as html | |
import pandas as pd | |
import plotly.graph_objs as go | |
from dash.dependencies import Output, Input, State | |
import dash_table_experiments as dt | |
from plotly.graph_objs.layout import Margin | |
app = dash.Dash(static_folder='static') |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
<html> | |
<head> | |
<meta name="viewport" content="width=device-width" /> | |
<title>ParticleSlider</title> | |
</head> | |
<body id="particle-slider"> | |
<div class="slides"> | |
<div id="first-slide" class="slide" | |
style="width: 100%; height 100%" | |
data-noise="100" |
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
import {ColDef, ColGroupDef, ColumnApi, GridApi} from 'ag-grid-community'; | |
import {AgGridReact} from 'ag-grid-react'; | |
import {AgGridReactProps} from 'ag-grid-react/lib/agGridReact'; | |
import {functions, isEqual, omit} from 'lodash'; | |
import log from 'loglevel'; | |
import React, {useState} from 'react'; | |
import useDeepCompareEffect from 'use-deep-compare-effect' | |
const gridStateChangeEvents = ['model', 'displayedColumnsChanged']; |
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
import { Observable } from 'rxjs'; | |
import { computed, IValueDidChange } from 'mobx'; | |
import isNil from 'lodash/isNil'; | |
import omit from 'lodash/omit'; | |
import { IEqualsComparer } from 'mobx/lib/internal'; | |
interface ToObservableOptions<T> { | |
initial?: boolean; | |
equals?: IEqualsComparer<T>; | |
} |
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
function pivot(meltedData, pivotCols: string[], varName: string, valueName: string) { | |
const groups = {}; | |
for (const d of meltedData) { | |
const key = pivotCols.map((k) => d[k]).join('|'); | |
const group = groups[key]; | |
groups[key] = { | |
...(group ? group : fromPairs(pivotCols.map((k) => [k, d[k]]))), | |
[d[varName]]: d[valueName], | |
}; |
OlderNewer