Skip to content

Instantly share code, notes, and snippets.

@bhstahl
bhstahl / README.md
Last active April 14, 2020 19:51
A cli for launching/stopping Global Protect (and stopping it from auto-launching on restart)
  1. Create a folder to hold your custom bash commands
$ mkdir ~/.bin
  1. Download the vpn file above to that directory
curl https://gist.githubusercontent.com/bhstahl/a90d747683ea0598c673e42d7f5a8900/raw/75cf1751c315795619399ef0e6b53a0297af3040/vpn --output ~/.bin/vpn
@bhstahl
bhstahl / Enhance.js
Created January 20, 2016 17:43 — forked from sebmarkbage/Enhance.js
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
@bhstahl
bhstahl / ES2015-a-Promise-for-simpler-networking.md
Created October 14, 2015 21:56
ES2015: a Promise for simpler networking

ES2015: a Promise for simpler networking


XHR & FETCH

    var xhr = new XMLHttpRequest();     fetch(url)
    xhr.open('GET', url);                 .then(res => res.json())
    xhr.responseType = 'json';            .then(console.log)
@bhstahl
bhstahl / introrx.md
Created October 7, 2015 19:32 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@bhstahl
bhstahl / run-worker.sh
Last active August 29, 2015 14:26 — forked from taylorhughes/run-worker.sh
Celery example with tasks of varying length + -Ofair
# tested with celery[redis]==3.1.17
# to run with default configuration -- tasks will take 14 seconds to complete the 20 tasks in start_all() below
celery worker -A cluster_project.celery_app -Q tester -lINFO --concurrency=4
# to run with -Ofair -- tasks will take 10 seconds to complete
celery worker -A cluster_project.celery_app -Q tester -lINFO --concurrency=4 -Ofair
@bhstahl
bhstahl / performance_review.md
Last active August 29, 2015 14:26
Performance Review Template
Answer on a five-point scale, from strongly agree to strongly disagree.
  1. Given what I know of this person’s performance, and if it were my money, I would award this person the highest possible compensation increase and bonus.

     >
    
  2. Given what I know of this person’s performance, I would always want him or her on my team.

     >
    
#import <UIKit/UIKit.h>
#import <ImageIO/ImageIO.h>
#import <MobileCoreServices/MobileCoreServices.h>
static UIImage *frameImage(CGSize size, CGFloat radians) {
UIGraphicsBeginImageContextWithOptions(size, YES, 1); {
[[UIColor whiteColor] setFill];
UIRectFill(CGRectInfinite);
CGContextRef gc = UIGraphicsGetCurrentContext();
CGContextTranslateCTM(gc, size.width / 2, size.height / 2);
@bhstahl
bhstahl / node_env
Created March 27, 2015 20:40
Python script to manage nvm and ST3 pathing for OSX
# Sublime package NVM node path configuration
# Save this file in:
# ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/node_env.py
import os
import getpass
user = getpass.getuser()
nvm_default_file_path = '/Users/%(user)s/.nvm/alias/default' % {'user': user}
@bhstahl
bhstahl / pydoc.sublime-snippet
Created January 29, 2015 14:13
Javadoc Style Documentation For Python
<snippet>
<content><![CDATA[
"""
Some description of what this function
does in great, explicit detail.
@type a: number
@param a: Some number used.
@type b: string
@param b: Some string used.
@bhstahl
bhstahl / jsdoc.sublime-snippet
Created December 26, 2013 13:23
JS Documentation Template Snippet
<snippet>
<content><![CDATA[
/**
* Some Description.
*
* @param {String} param1 Some Text on Param 1.
* @param {String} param2 Some Text on Param 2.
* @return {String} return Some Text on the Return.
*/
]]></content>