Skip to content

Instantly share code, notes, and snippets.

View jschoolcraft's full-sized avatar

Jeff Schoolcraft jschoolcraft

View GitHub Profile
@jschoolcraft
jschoolcraft / brew.md
Created September 5, 2022 15:29 — forked from pudquick/brew.md
Lightly "sandboxed" homebrew on macOS

brew is a bad neighbor

This isn't a guide about locking down homebrew so that it can't touch the rest of your system security-wise.

This guide doesn't fix the inherent security issues of a package management system that will literally yell at you if you try to do something about "huh, maybe it's not great my executables are writeable by my account without requiring authorization first".

But it absolutely is a guide about shoving it into its own little corner so that you can take it or leave it as you see fit, instead of just letting the project do what it likes like completely taking over permissions and ownership of a directory that might be in use by other software on your Mac and stomping all over their contents.

By following this guide you will:

  • Never have to run sudo to forcefully change permissions of some directory to be owned by your account
@jschoolcraft
jschoolcraft / tabs.rb
Last active April 4, 2022 12:48
Print a markdown formatted list of tabs from all Brave windows
#!/usr/bin/env ruby
# stolen from https://superuser.com/questions/489207/get-the-currently-open-tabs-in-google-chrome-via-the-command-line
window_count = %x(osascript -e 'tell application "Brave Browser" to get number of windows').to_i
exit if window_count == 0
tabs = []
1.upto(window_count).each do |win|
tab_count = %x(osascript -e 'tell application \"Brave Browser\" to get number of tabs in window #{win}').to_i
@jschoolcraft
jschoolcraft / flake-direnv.md
Created March 4, 2022 12:42 — forked from inscapist/flake-direnv.md
Nix Flakes and Direnv on Mac OSX (Catalina)

Development environment with Nix Flakes and Direnv

This document is targeted at those who seek to build reproducible dev environment across machines, OS, and time.

It maybe easier for remote teams to work together and not spending hours each person setting up asdf/pyenv/rbenv, LSP servers, linters, runtime/libs. Nix is probably the closest thing to Docker in terms of development environment.

Flake is used here because it provides hermetic build, with absolutely no reliance on system environment (be it Arch/Catalina/Mojave). Also it freezes dependencies in flake.lock so builds are reproducible.

This gist provides the setup to develop Java/Clojure/Python applications on Nix. But it can be easily adapted to ruby, nodejs, haskell.

@jschoolcraft
jschoolcraft / byebug_commands.md
Created January 22, 2021 18:23 — forked from elrayle/byebug_commands.md
Byebug Cheatsheet - organized by related commands

Byebug Cheatsheet

This cheatsheet includes most of the byebug commands organized by related commands (e.g. breakpoint related commands are together).

To see official help...

Command Aliases Example Comments
help h h list top level of all commands
help cmd h cmd-alias h n list the details of the next command (this works for all commands)
@jschoolcraft
jschoolcraft / keybase.md
Created January 12, 2021 19:57
keybase.md

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@jschoolcraft
jschoolcraft / confident-code.md
Created May 18, 2011 23:28 — forked from jraines/confident-code.md
Notes on Avdi Grimm's "Confident Code"

Confident Code

timid code

  • Randomly mixes input gathering, error handling, and business logic
  • imposes cognitive load on the reader

confident code

  • no digressions
@jschoolcraft
jschoolcraft / reactRailsTestSetup.md
Created October 9, 2018 21:24 — forked from andrewprogers/reactRailsTestSetup.md
Setting up A new React on Rails app with webpacker and full test suite

React on Rails with Test Suite (Karma, Jasmine, Enzyme, PhantomJS)

The steps included here detail the steps I followed to get a new React on Rails app set up, with a focus on testing JS components with Karma / Jasmine / Enzyme. A lot of this was liberally borrowed / modified from the Launch Academy curriculum, but there are some additional steps involved to get everything working with webpacker:

Unless otherwise specified, run the code in the terminal

Install Rails with Webpacker configured for React:

rails new project-name
cd project-name
@jschoolcraft
jschoolcraft / spec_helper.rb
Created September 10, 2009 12:27
This is how I spec AuthLogic be9-acl9 using rspec
# This file is copied to ~/spec when you run 'ruby script/generate rspec'
# from the project root directory.
ENV["RAILS_ENV"] ||= 'test'
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
require 'spec/autorun'
require 'spec/rails'
require 'webrat'
require 'remarkable_rails'
require "email_spec/helpers"
require "email_spec/matchers"
@jschoolcraft
jschoolcraft / gist:2876923
Created June 5, 2012 18:52 — forked from chrismdp/gist:2768532
Paypal IPN integration in about 30 lines of Sinatra.
diff --git a/app/account.rb b/app/account.rb
index a108685..c89ad34 100644
--- a/app/account.rb
+++ b/app/account.rb
@@ -1,4 +1,22 @@
+require 'open-uri'
+
module Sol
+ class Url
+ def self.get(url)

Here's how to install PostgreSQL and have it run automatically at startup, on an Ubuntu 10.04 virtual machine using Vagrant. This took me a while to figure out:

Add the default lucid32 base box to your vagrant, if you haven't already:

host> vagrant box add lucid32 http://files.vagrantup.com/lucid32.box 

Now make a new lucid32 virtual machine and install postgresql on it: