Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View jasonrhodes's full-sized avatar

Jason Rhodes jasonrhodes

View GitHub Profile
@jasonrhodes
jasonrhodes / getProperty.js
Created April 6, 2012 17:40
Get a nested object property by passing a dot notation string as the property name
/**
* A function to take a string written in dot notation style, and use it to
* find a nested object property inside of an object.
*
* Useful in a plugin or module that accepts a JSON array of objects, but
* you want to let the user specify where to find various bits of data
* inside of each custom object instead of forcing a standardized
* property list.
*
* @param String nested A dot notation style parameter reference (ie "urls.small")
<?php
/*
Plugin Name: Videos
Plugin URI:
Author: Dave Rupert
Author URI: http://www.daverupert.com
Description: A custom post type that adds videos and custom taxonomies.
Version: 1.0
*/
@jasonrhodes
jasonrhodes / mbp-setup.markdown
Last active December 22, 2022 17:20
Setting up my new MacBook Pro
  • Set up user account
  • Name computer
  • Check trackpad settings
  • Install Google Chrome
  • Install Homebrew http://brew.sh/
  • Brew should auto-install Xcode Developer Tools for you
  • $ brew doctor
  • $ brew install git
  • Download node.js (I prefer the installer over brew) http://nodejs.org/download/
  • npm is now installed, too
@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 / timezone.sh
Last active January 10, 2022 23:13
Manage your Mac OS X timezone like, super easy and stuff
#!/usr/bin/env bash
get() {
sudo systemsetup -gettimezone
}
set() {
sudo systemsetup -settimezone $1
}
@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:

@jasonrhodes
jasonrhodes / Scientist.js
Last active September 27, 2019 14:36
Helper library for working with Google Analytics.
/**
* Scientist.js
*
* A small helper library for working with Google Analytics.
*
* @author Jason Rhodes
* @version 0.2
*
*/
var Scientist = function (analytics) {

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"