Skip to content

Instantly share code, notes, and snippets.

View brandondrew's full-sized avatar

Brandon Zylstra brandondrew

  • UC Berkeley
  • the tubes
View GitHub Profile
@brandondrew
brandondrew / button_progress_controller.js
Created February 22, 2024 03:20 — forked from dbreunig/button_progress_controller.js
Poor man's form button progress indicator, in Stimulus, for those long processing requests.
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
connect() {
addEventListener("turbo:submit-end", ({ target }) => {
clearInterval(this.interval);
this.element.innerHTML = this.originalLabel;
})
this.originalLabel = this.element.innerHTML;
}
@brandondrew
brandondrew / upgrading_ruby_for_rails
Last active January 3, 2023 04:46
How To Upgrade Ruby for your Rails App, Locally & on a Server with Passenger
Overview
--------
Consider the commands given to be examples, not to necessarily be precisely
what you will use. They were based on my circumstances, in which
* my local platform is macOS,
* where Homebrew is the de facto package manager;
* my laptop (and the server) are managing Ruby with rbenv;
* vim is my remote editor of choice, and an acceptable local editor; and
@brandondrew
brandondrew / build_home.sh
Last active December 23, 2021 14:16
Script to automatically build your new home directory on Unix or Linux boxes (with Spartan enhancements)
#!/bin/bash
###############################################################
# BUILD HOME script:
# This script sets up your home directory fast with basic
# necessities and amenities, to give you sanity when you
# work on a Unix box where you don't have root access.
###############################################################
### TO USE:
# wget https://gist.github.com/raw/3639058/build_home.sh
# bash build_home.sh
@brandondrew
brandondrew / install-pt
Created December 30, 2016 20:04
Easily install the Platinum Searcher (on Linux) (to your personal bin directory)
#!/usr/bin/env bash
OS_CODE="linux_amd64"
# TODO: check the OS and architecture and make this work across platforms
VERSION="v2.1.5"
# TODO: scrape the GitHub README for the latest version
TARGET=~/bin
# TODO: accept command line options, and prompt if nothing is specified
############################################
## uncomment these lines for CGI mode
## make sure to specify the correct cgi php binary file name
## it might be /cgi-bin/php-cgi
# Action php5-cgi /cgi-bin/php5-cgi
# AddHandler php5-cgi .php
############################################
## GoDaddy specific options
Goals
Editable by Supervisor
Employee Data Safe
Supervisor Edits Goals -> Editable by Supervisor
Supervisor Assigns Rights to Employee -> Editable by Employee
Employee Data Lost
No Simple Solution -> Employee Data Lost
Editable by Employee
Employee Data Still Safe
Employee Begins Editing Goals -> Employee Data at Risk
@brandondrew
brandondrew / rubydo.cr
Last active May 15, 2019 14:35
examples of syntax for RubyDo
# goal: pass code to a Ruby interpreter running in background as a daemon
greeting = "hello"
source = "Ruby"
# desired syntax, which is impossible because the Crystal parser & lexer cannot ignore everything between `ruby do` & `end`
ruby do |greeting, source|
# put Ruby code here as just part of a normal block:
puts "#{greeting} from #{source}!"
end
# https://wikihub.berkeley.edu/display/robots/CC+-+20181213+More+Changes+to+Pilot+Specs
Proposed Performance Pilot Workflow - Newest
No Review Exists*
Create New Form -> Supervisor Starts Form
Review In Process
Supervisor Starts Form
Save -> Draft
Save & Share with Employee -> Participants Comment and Sign
New*
Draft
@brandondrew
brandondrew / undefined_processingIndicator
Created February 6, 2014 23:32
dynatable.processingIndicator is undefined
<!DOCTYPE html>
<html>
<head>
<title>Ad-Related Reports</title>
<script src="./vendor/jquery-1.7.2.min.js"></script>
<script src="./jquery.dynatable.js"></script>
<link rel="stylesheet" type="text/css" href="./jquery.dynatable.css">
<link rel="stylesheet" type="text/css" href="./bootstrap/css/bootstrap.min.css">
<script src="./bootstrap/js/bootstrap.min.js"></script>
<script src="jquery.ba-replacetext.min.js"></script>
@brandondrew
brandondrew / SketchSystems.spec
Created October 4, 2018 02:57
Proposed Performance Pilot Workflow - Steps
Proposed Performance Pilot Workflow - Steps
No Review Exists*
Create New Form -> Supervisor Starts Conversation
Review In Process
Supervisor Starts Conversation
Save as Draft -> Supervisor Starts Conversation
Share with Employee -> Participants Comment
Participants Comment
Employee Comments -> Participants Comment
Supervisor Edits and Comments -> Participants Comment