Skip to content

Instantly share code, notes, and snippets.

View brentd's full-sized avatar

Brent Dillingham brentd

  • Asheville, NC
View GitHub Profile
@brentd
brentd / gist:5017017
Last active December 14, 2015 02:49
Require outside of bundle
# Allows `require` to work for libs outside of Bundler's environment, so you can require
# gems that aren't in the project's Gemfile while inside an irb session (for example).
if defined?(Gem.post_reset_hooks)
Gem.post_reset_hooks.reject!{ |hook| hook.source_location.first =~ %r{/bundler/} }
Gem::Specification.reset
load 'rubygems/custom_require.rb'
alias gem require
end

Three.JS Cubes

@brentd
brentd / combineLatestActive.js
Last active November 7, 2017 20:41
combineLatestActive: like combineLatest, but for a stream of streams, and only combines non-completed streams
import { Observable } from 'rxjs'
// Takes a higher-order observable as input and subscribes to its inner
// observables. Emits an array containing the last emitted value from each *active*
// inner observable when:
//
// 1. any inner observable emits
// 2. any inner observable completes
//
// In contrast to `combineLatest`, the latest value from completed observables
@brentd
brentd / bashdb
Created June 26, 2019 14:25
bashdb
#!/bin/bash
DBNAME=${DBNAME:-database}
help() {
echo "A very lol key/value database written in bash.
usage: bashdb <command> <args>
get <key> Get a value from the database
@brentd
brentd / webmock_stubbing_helper.rb
Created August 2, 2019 16:39
Webmock stubbing helper
# Quick way to log both stubbing instructions and the response of a real request.
# Useful for stubbing real requests without having to resort to VCR.
WebMock.allow_net_connect!
WebMock.after_request do |request_signature, response|
puts "\nA real HTTP request was made."
puts WebMock::RequestSignatureSnippet.new(request_signature).stubbing_instructions
puts "----- RESPONSE HEADERS -----"