Skip to content

Instantly share code, notes, and snippets.


Michael Ziwisky mziwisky

  • Instructure
  • San Diego, CA
View GitHub Profile

ruby-debug cheatsheet

s[tep] -- step into next call

n[ext] -- step over next call

l[ist] = -- show the current line, in context. e.g.:

   26          end
   27        end
View gist:8bd4e62376e6ffdf053e8027deaec284
* 3e39dc2 (HEAD -> declare-positionState, origin/declare-positionState) declare positionState var
* 6bb203e (origin/remove-jsx-pragma, remove-jsx-pragma) remove `@jsx` pragma from source
* e64cb8e (origin/react-0.14, react-0.14) update for react-0.14
* 18fcafd (origin/allow-role-override, allow-role-override) allow overriding role and setting arbitrary props on MenuOption
* dee59db (neil/master, neil-clickblur-handling) Limit focusing of react-menu to fix UI bug
* db914fc (duane/remove-constrain, duane/master, duane) Remove constrain
* 16a04d3 (neil/preferred_position, duane/preferred_position) Use react getDefaultProps instead of constrain
* fac6ffa Add preferredHorizontal and preferredVertical props
* 103b0c3 (neil/toggle_option, duane/toggle_option) Add keepOpenOnSelect boolean option to Menu
| * 8288c86 (karma-webpack) WIP replace browserify with webpack for builds
mziwisky / foo.js
Created Dec 6, 2016
unbinding of `this` for `import { x } from "y";` syntax
View foo.js
let foo = {
alpha () {
return this.bravo();
bravo () {
return "charlie";
export default foo;
mziwisky / output.txt
Created Feb 28, 2017
aws-sdk Aws::S3::Object#copy_from vs #copy_to
View output.txt
irb(main):001:0> require_relative 'test'
AWS SDK version: 2.7.16
== TEST: test_copy_west_from_east
== TEST: test_copy_east_from_west
# ^ copy_from works fine regardless of direction
mziwisky / focusWithMethod.jsx
Created Nov 1, 2017
comparison of using props vs invoking a method to tell a child component to focus something
View focusWithMethod.jsx
Child = React.createClass({
focusThing () {
render () {
return (
Here's the thing to <button ref={ el => this.btn = el }>focus</button>
mziwisky / AjaxInterceptorManager.js
Created Jan 22, 2015
ajax interceptor management
View AjaxInterceptorManager.js
var authExpirationHandler,
function catchUnauthorizedResponses(data) {
if (data.status === 401 && !maybeLocalStorage.getItem("token")) {
// ensure the in-memory session really is expired before destroying it
return axios.get("/api/auth/session").then(
(response) => {
// we ARE still auth'd, so just throw the error down the chain
throw data;
mziwisky / dinghy.yml
Created Jun 6, 2019
dory and dinghy config
View dinghy.yml
# ~/.dinghy/preferences.yml
:unfs_disabled: false
:proxy_disabled: true
:dns_disabled: false
:fsevents_disabled: false
cpus: 4
memory: 16384
mziwisky / main.rb
Last active Nov 9, 2020
proxying I/O from one script to another
View main.rb
#!/usr/bin/env ruby
require 'open3'
puts 'party time'
output = ''
status = Open3.popen2e('./sub.rb') do |std_in, std_out_err, wait_thr| do
while out = std_out_err.readpartial(64)
mziwisky /
Last active Jan 11, 2021
Oauth2 Explanation


The Problem

I’m a web app that wants to allow other web apps access to my users’ information, but I want to ensure that the user says it’s ok.

The Solution

I can’t trust the other web apps, so I must interact with my users directly. I’ll let them know that the other app is trying to get their info, and ask whether they want to grant that permission. Oauth defines a way to initiate that permission verification from the other app’s site so that the user experience is smooth. If the user grants permission, I issue an AuthToken to the other app which it can use to make requests for that user's info.

Note on encryption

Oauth2 has nothing to do with encryption -- it relies upon SSL to keep things (like the client app’s shared_secret) secure.