Skip to content

Instantly share code, notes, and snippets.

Andrew Clancy nite

Block or report user

Report or block nite

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@nite
nite / AgGridWrapper.tsx
Created Mar 5, 2020
ag-grid wrapper with persistence of grid column & filter state in localStorage
View AgGridWrapper.tsx
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'];
@nite
nite / index.html
Created Oct 21, 2019
Interactive Particle Logo
View index.html
<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"
@nite
nite / js.ipynb
Last active Apr 1, 2019
Jupyter Notebook with client-side javascript interactive data visualisation in d3 & Plotly plots, plus a http fetch
View js.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nite
nite / plotly_crossfilter.py
Last active Aug 3, 2018
Plotly Dash Crossfilter
View plotly_crossfilter.py
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')
@nite
nite / grid-selection.directive.ts
Last active Aug 15, 2018
Typescript ag-Grid Range selection directive which selects & highlights rows for any selected cell & emits a 'rangeSelectionRowsChanged' with a rows property of selected rows.
View grid-selection.directive.ts
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.
@nite
nite / kvp.js
Last active Jan 5, 2018
Serialise input as key-value pair string, eg. for human-readable logs.
View kvp.js
/**
* 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}
*/
@nite
nite / curry.py
Last active May 29, 2017
A simple curry function in python
View curry.py
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)
View debounce.R
# 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.
You can’t perform that action at this time.