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 / SketchSystems.spec
Created September 16, 2018 23:37 — forked from lynaghk/SketchSystems.spec
Search Bar*
Search Bar*
Inactive*
focused -> Active
Active
canceled -> Inactive
typed -> Text Entry
Empty*
@brandondrew
brandondrew / capybara cheat sheet
Last active April 26, 2018 19:12 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@brandondrew
brandondrew / README
Last active August 1, 2016 18:35 — forked from rwest/README
Convert OS X Keychain exported entries into logins for 1Password import
These two files should help you to export passwords from a Mac OS X keychain for import into 1password.
Assumptions:
1) You have some experience with scripting/are a power-user. These scripts worked for me
but they haven't been extensively tested and if they don't work, you're on your own!
Please read this whole document before starting this process. If any of it seems
incomprehensible/frightening/over your head please do not use these scripts. You will
probably do something Very Bad and I wouldn't want that.
2) You have ruby 1.9.2 installed on your machine. This comes as standard with Lion, previous
versions of OS X may have earlier versions of ruby, which *may* work, but then again, they

Launch a one-off git server from any local repository.

I [tweeted this already][1] but I thought it could use some expansion:

Enable decentralized git workflow: git config alias.serve "daemon --verbose --export-all --base-path=.git --reuseaddr --strict-paths .git/"

Say you use a git workflow that involves working with a core "official" repository that you pull and push your changes from and into. I'm sure many companies do this, as do many users of git hosting services like Github.

Say that server, or Github, goes down for a bit.

@brandondrew
brandondrew / tmux_local_install.sh
Created October 19, 2012 00:18 — forked from ryin/tmux_local_install.sh
bash script for installing tmux without root access
#!/bin/bash
TMUX_VERSION="1.7"
LIBEVENT_VERSION="2.0.20"
NCURSES_VERSION="5.9"
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
@brandondrew
brandondrew / beanstalkd-macports-1.4.6_1.txt
Created September 30, 2011 00:50
How to fix beanstalkd 1.4.6 compile error (MacPorts)
Just a informational gist if you plan to install "beanstalkd" via MacPorts and get a compiler error:
:info:build net.c: In function 'make_server_socket':
:info:build net.c:35: warning: 'fd' may be used uninitialized in this function
:info:build make[1]: *** [net.o] Error 1
:info:build make[1]: *** Waiting for unfinished jobs....
This is a known issue within the "net.c" file. I've found a diff[1] for said file on the web and applied it locally which then allowed me to install the port without problems.
If your install fails like:
require 'feedzirra'
# fetching a single feed
feed = Feedzirra::Feed.fetch_and_parse("http://feeds.feedburner.com/PaulDixExplainsNothing")
# feed and entries accessors
feed.title # => "Paul Dix Explains Nothing"
feed.url # => "http://www.pauldix.net"
feed.feed_url # => "http://feeds.feedburner.com/PaulDixExplainsNothing"
feed.etag # => "GunxqnEP4NeYhrqq9TyVKTuDnh0"