Skip to content

Instantly share code, notes, and snippets.


Brian A. Danielak briandk

View GitHub Profile
briandk /
Last active Aug 22, 2018
Useful commands for Anaconda Python

Update to a newer version of anaconda

conda update --prefix /anaconda3 anaconda

Upgrade all conda packages to their latest version

conda update --all
briandk /
Created Aug 1, 2018
Useful short commands. FAQs by me. As in, I frequently have these questions


git remote prune origin prunes tracking branches not on the remote. Run with a -n flag to do a dry run. Source

View renderPropsInReact.jsx
class WrapperComponent extends React.Component {
render() {
const style = { border: "solid 1px " + this.props.color };
return <div style={style}>{this.props.children}</div>;
class HelloMessage extends React.Component {
render() {
var Wrapper = this.props.wrapper;
briandk /
Created Apr 23, 2018
Shell one-liner commands
# Remove untagged docker images
docker rmi (docker images | awk '/<none>/ {print $3}')
briandk /
Last active Jul 19, 2018
Example functions (and arrow functions) in Typescript with target `es2017`

Defining an Object Type

const myObject: { [key: string]: string } = {foo: 'bar'}

Annotating Function Types

With target=es2017 and TypeScript 2.8

briandk /
Last active Apr 17, 2018
Useful git shortcuts
# via
# prunes tracking branches not on the remote.
git remote prune origin
# lists branches that have been merged into the current branch.
git branch --merged
# deletes branches listed on standard input.
xargs git branch -d
briandk / QuillDeltaToString.js
Created Sep 28, 2017
Converting a quill delta into a string
View QuillDeltaToString.js
// Assuming the delta is entirely insert operations,
// this example wouuld convert bolded text to html bolded text.
// The key logic here is mapping over the insert ops,
// then joining the resulting array on the empty string
html = delta.slice(0, 500) {
if (typeof op.insert !== 'string') return '';
let html = op.insert;
if (op.attributes.bold) {
html = '<strong>' + html + '</strong>';
briandk / extendingClassesInJavaScript.js
Created Jun 30, 2017
Extending classes in Quill to create a Timestamp Class
View extendingClassesInJavaScript.js
const Quill = require('quill');
const Link = Quill.import('formats/link');
class Timestamp extends Link {
static create(value) {
let node = super.create(value);
value = this.sanitize(value);
node.setAttribute('href', value);
briandk / college-majors.ipynb
Created Apr 17, 2017
Beginning analysis of 538's college majors data
View college-majors.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
briandk /
Last active Apr 10, 2017
Basic plotting and forest creation functions for the forest fire model in CMSE 201 Spring 2017
import matplotlib.pyplot as plt
from matplotlib import colors
import numpy as np
def make_forest( height, width, density ):
This function will take in a width, height, and density specified by the user and use those values
to generate a forest (2-d numpy array) matching those characteristics. A 0 will represent an empty
space, a 1 will represent a tree