Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am mjyoung on github.
  • I am mjyoung (https://keybase.io/mjyoung) on keybase.
  • I have a public key ASDC34vk9YjcE9f6DRIEax30bQQHN_HW225iqffsznMYWAo

To claim this, I am signing this object:

@mjyoung
mjyoung / Caddyfile
Created September 13, 2021 16:31 — forked from fu-sen/Caddyfile
Caddy v2 (Officical Docker Image) with Google Cloud Run (Freely editable Caddyfile) https://caddy.community/t/caddy-works-with-google-cloud-run/6898
:{$PORT}
root * /usr/share/caddy
# Do not rewrite up to this point!
file_server
templates
@mjyoung
mjyoung / ApolloClient.js
Last active November 30, 2018 16:53
React Native / MobX / Apollo GraphQL
// utils/ApolloClient.js
import ApolloBoost from 'apollo-boost';
import { AsyncStorage } from 'react-native';
import Config from '../config';
const client = () => {
return new ApolloBoost({
uri: Config.API_URL,
request: async operation => {
const authToken = await AsyncStorage.getItem('AUTH_TOKEN');
@mjyoung
mjyoung / bitbar-mic-toggle.1s.sh
Last active September 19, 2017 23:34
Alfred + BitBar workflow for toggling microphone mute. Used with https://github.com/mjyoung/alfred-mic-hotkey-toggle
#!/bin/bash
#BitBar Metadata
# <bitbar.title>BitBar Mic Toggle</bitbar.title>
# <bitbar.version>v0.1</bitbar.version>
# <bitbar.author>Michael Young</bitbar.author>
# <bitbar.author.github>Michael Young</bitbar.author.github>
# <bitbar.desc></bitbar.desc>
max_chars="30"
mic_on_icon="iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAY1BMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABmaHTeAAAAIHRSTlMAAQMGBwoMDxATNDg9RlVgbXJ2iIqYsLXIytXY2+D1+HJ58qkAAAB7SURBVHjadc3LGkAgEIbhQk7lNESRdP9XSeOpbHyr+d/NECwftB5ykhrd0/iB3cOeduWwKkL9Qv0HPQSAHmFeA6wzwqSo8dtQNSF0loEHYLZDKA5ZgjFQyqMgmLgko5TJS4S37WmVsmdLYpnQWmRpN5xvG+dNhMVhi79vdasMEyEIOi4AAAAASUVORK5CYII="
@mjyoung
mjyoung / tab.bash
Created June 8, 2017 20:08 — forked from vitalybe/tab.bash
Open new Terminal tabs from the command line
#!/bin/bash
#
# Open new Terminal tabs from the command line
#
# Author: Justin Hileman (http://justinhileman.com)
#
# Installation:
# Add the following function to your `.bashrc` or `.bash_profile`,
# or save it somewhere (e.g. `~/.tab.bash`) and source it in `.bashrc`
#
@mjyoung
mjyoung / app.js
Created March 17, 2017 01:16 — forked from acdlite/app.js
Quick and dirty code splitting with React Router v4
// getComponent is a function that returns a promise for a component
// It will not be called until the first mount
function asyncComponent(getComponent) {
return class AsyncComponent extends React.Component {
static Component = null;
state = { Component: AsyncComponent.Component };
componentWillMount() {
if (!this.state.Component) {
getComponent().then(Component => {
@mjyoung
mjyoung / README.md
Created November 12, 2015 21:58 — forked from ngryman/README.md
intellij javascript live templates

intellij javascript live templates

Just a dump of handy live templates I use with IntelliJ. They should also work with WebStorm.

How to

  • Go to settings.
  • Search for live templates.
  • Under the javascript section you should be able to manage your templates.
@mjyoung
mjyoung / react-modal-flexbox.js
Last active July 13, 2023 02:54
rackt/react-modal override default styles to use flexbox for modal positioning
const modalCustomStyles = {
overlay : {
position : 'fixed',
top : 0,
left : 0,
right : 0,
bottom : 0,
display : 'flex',
alignItems : 'center',
justifyContent : 'center',

Please complete the following challenge and submit your response in a gist.

Write your code with the following priorities in mind, in order from most to least important:

  • Correctness and completeness
  • Clarity and readability
  • Conciseness and performance

Without further ado:

require 'pry'
class RaceTrack
attr_accessor :time, :cars
def initialize
@time = 0
@cars = []
end