Skip to content

Instantly share code, notes, and snippets.

View jasonrhodes's full-sized avatar

Jason Rhodes jasonrhodes

View GitHub Profile
@jasonrhodes
jasonrhodes / ruby-agent-blank-hostnames.json
Last active August 15, 2022 18:23
Ruby agent APM documents
{
"_index": ".ds-metrics-apm.internal-default-2022.07.25-000006",
"_id": "CMO1ooIBzPFW3SMwqU5-",
"_version": 1,
"_score": 0,
"_source": {
"container": {
"id": "b2f7a1658b1d0df18aaab5dd5b9c3d43b2572c957386ea39c13e6c9af3fa0803"
},
"system.process.cpu.total.norm.pct": 0.0004199563245422476,
@jasonrhodes
jasonrhodes / keybase.md
Created September 13, 2021 18:48
Keybase ID

Keybase proof

I hereby claim:

  • I am jasonrhodes on github.
  • I am elasticjason (https://keybase.io/elasticjason) on keybase.
  • I have a public key ASCGpw7vdP3quswdwWcZCOqRRMt-felhYC-kXMp9EO-ZYAo

To claim this, I am signing this object:

Student Fit Problem

T is the number of total students
n is the number of teachers/classes
c is the number of students per class

c = T / n

for every value of n, I want to also compute r, or "the number of students you can add to T to get c to rise to the next whole number"

import { trackUiMetric } from '../wherever'
export function TrackVisit({ app, path, delay = 0 }) {
if (!delay) {
trackUiMetric(app, `visit__${path}`) // something like visit__transactions_list_page
}
useEffect(() => {
if (!delay) {
return;
}
@jasonrhodes
jasonrhodes / yarn.lock
Created May 29, 2019 10:24
Mulltiple copies of package in yarn.lock ... why?
react@^16.2.0, react@^16.6.0, react@^16.8.0:
version "16.8.2"
resolved "https://registry.yarnpkg.com/react/-/react-16.8.2.tgz#83064596feaa98d9c2857c4deae1848b542c9c0c"
integrity sha512-aB2ctx9uQ9vo09HVknqv3DGRpI7OIGJhCx3Bt0QqoRluEjHSaObJl+nG12GDdYH6sTgE7YiPJ6ZUyMx9kICdXw==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"
prop-types "^15.6.2"
scheduler "^0.13.2"
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;
}
@jasonrhodes
jasonrhodes / debug-diff.js
Last active November 30, 2018 04:01
Compares two objects and gives you detailed diff results about added, removed, changed, and ref-only changes
/**
* 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];
@jasonrhodes
jasonrhodes / kibana-build-flow.md
Last active November 26, 2018 18:44
Schoolhouse Rock: How a Kibana becomes a build (specifically client-side webpack)
@jasonrhodes
jasonrhodes / why.js
Created November 2, 2018 14:44
implicit function naming quirk?
// file1a.js
const CoolName = () => 'cool'
export { CoolName }
// file2a.js
import { CoolName } from './file1a'
console.log(CoolName.name) // -> "CoolName"
/**
#!/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