Skip to content

Instantly share code, notes, and snippets.

Avatar

Eric Boehs ericboehs

View GitHub Profile
View proxy.pac
function FindProxyForURL(url, host) {
PROXY = "SOCKS5 127.0.0.1:2001;SOCKS 127.0.0.1:2001"
if (shExpMatch(host,"*.vfs.va.gov")) {
return PROXY;
}
if (shExpMatch(host,"*.vetsgov-internal")) {
return PROXY;
}
View blink-solarized.js
View s3_directory_service.rb
# frozen_string_literal: true
# This file lives in lib/active_storage/service/s3_directory_service.rb.
require 'aws-sdk-s3'
require 'active_storage/service/s3_service'
require 'active_support/core_ext/numeric/bytes'
module ActiveStorage
class Service
View assinc.rb
require 'minitest/autorun'
class TestArray < Minitest::Test
def test_array
assert_includes %(a b c), 'a'
end
def test_array_refutation
refute_includes %(a b c), 'd'
end
View yts_downloader
#! /usr/bin/env ruby
require 'cgi'
require 'net/http'
require 'json'
# Adds a movie to put.io based on search term
class MovieDownloader
attr_reader :term
@ericboehs
ericboehs / application_record.rb
Last active Sep 7, 2019
Helper method to get the URL to an ActiveStorage Blob/Variant
View application_record.rb
# frozen_string_literal: true
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
def attached_url_for(attached, variant: nil, cloudfront_endpoint: ENV['CLOUDFRONT_ENDPOINT'], fallback_url: nil)
if attached.attached?
attached = attached.variant variant if variant
path_helper = Rails.application.routes.url_helpers.method :rails_blob_path
@ericboehs
ericboehs / index.html
Last active Aug 25, 2019
Sticky side and top nav via UIKit and position: sticky
View index.html
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.1.7/css/uikit.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.1.7/js/uikit.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/3.1.7/js/uikit-icons.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
.tm-height-100vh { height: 100vh; }
.tm-position-top-sticky {
@ericboehs
ericboehs / autocomplete.html
Last active Jul 16, 2019
Vanilla JavaScript Autocomplete
View autocomplete.html
<!-- Check out the codepen here: https://codepen.io/anon/pen/jjjJoG -->
<div class="uk-container-xsmall uk-margin-top uk-margin-auto">
<input class="tm-autocomplete-input uk-input" autocomplete="false" type="text" placeholder="Search Country...">
<ul class="tm-autocomplete" hidden></ul>
</div>
@ericboehs
ericboehs / # weechat - 2019-01-28_12-14-47.txt
Created Jan 28, 2019
weechat on macOS 10.14.2 - Homebrew build logs
View # weechat - 2019-01-28_12-14-47.txt
Homebrew build logs for weechat on macOS 10.14.2
Build date: 2019-01-28 12:14:47
@ericboehs
ericboehs / testing_weechat.sh
Last active Jan 25, 2019
weechat with curl doesn't work demo
View testing_weechat.sh
# Install working version
brew uninstall weechat; brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/4bdc1ce82824246dfa49d002033e1d6b2fcabe81/Formula/weechat.rb --with-python@2 --with-perl --with-ruby --with-lua --with-aspell
# Download perl script via weechat (make sure you type /quit in weechat to continue)
rm ~/.weechat/perl/multiline.pl ~/.weechat/perl/autoload/multiline.pl 2> /dev/null; weechat -r "/script install multiline.pl"; ls ~/.weechat/perl/multiline.pl 2>&1 > /dev/null && echo "It worked" || echo "It failed"
# Install broken version
brew uninstall weechat; brew install weechat
# Download perl script via weechat (make sure you type /quit in weechat to continue)
You can’t perform that action at this time.