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 / 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')
#!/usr/bin/env ruby
# This is a very rough proof-of-concept for an interactive automated checklist
# of things that you need to check to get iHat running properly.
#
# A new item can be easily added as a manual step for the developer to check.
# But each step can also have an automated check added to it, so that the
# developer doesn't need to spend time checking, or even know how to check
# a particular item in the list.
#
@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
@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
@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
@brandondrew
brandondrew / textmate_environment_variables.rb
Created June 20, 2015 03:52
TextMate environment variable reference
#!/usr/bin/env ruby
###############################################################
#
# Paste this into a TextMate document,
# press ⇧^⌥R and choose 'Ruby' from the menu that appears,
# and then press ⌘R to run this in the context of TextMate
# to see all TextMate environment variables and their values
#
###############################################################
@brandondrew
brandondrew / visit
Last active August 29, 2015 14:21
Visit another user's OS X account, but get a sane working environment, and set it back to whatever state they had it before when you're done.
#!/usr/bin/env bash
# install:
# curl https://gist.githubusercontent.com/brandondrew/dbed1910ec9ec2a331de/raw/acbab5356c0022e54361e51eff3f9f44780ee842/visit | bash
# TODO: this script should
# * be writtten in Ruby
# * be a single script or app (`drop in` & `drop out`?)
# * generate the 'leave' script, based on current settings and differences
# * generate a complete state of defaults before your visit (so you can restore anything)
@brandondrew
brandondrew / script.txt
Created June 24, 2014 23:54
Public CoreOS iPXE Script
#!ipxe
set base-url http://alpha.release.core-os.net/amd64-usr/current
kernel ${base-url}/coreos_production_pxe.vmlinuz sshkey="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDm62LTesk5YC9E7TXc8R9MYJes5NeKZraB+zI2hGpbqI9t31cdZWQBW87Uv8Tne6uD3n4ALSWvTJxrndl80tvC2hz+mLdhF3aiIZQl2jL17JL3rGe7iI7knChq482L5XT7KDVg+0ZEyZhTYvbPVoOJNzPG2BIbrjUyK8f0JUtnvnqJ4zl6tZzTe4rEYTp3YKNAPOv/7868Ka8VywVO3sx78Xj5sHtDWHAm5omrZvajC2jLmG+8N+uKRmY/G25uO8cZOGIB6DI4B0nIu9D9cMWBa+TPnoDKYACdHdwfz8qx1KUtGjS3I9uAcWQCvWXNYICnnhfDQ6hfvseXwKHzC/p7 brandon.zylstra@gmail.com"
initrd ${base-url}/coreos_production_pxe_image.cpio.gz
boot

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 / 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>