Skip to content

Instantly share code, notes, and snippets.

View pboling's full-sized avatar
🏓
Ping me if you need me!

Peter Boling pboling

🏓
Ping me if you need me!
View GitHub Profile

I upgraded to El Capitan, with Homebrew & Ruby, and this is how I did it flawlessly.

... and Xcode and Java, etc.

Prepare

If you don't already have homebrew installed, do that first, so you don't have to deal with SIP issues. Install all Software Updates available in the Apple Menu, up to and including El Capitan.

Hardware

@pboling
pboling / extract_embedded_flickr_image_url_for_google_sheets.rb
Last active March 1, 2017 10:51
Extract image URL from Flickr Embedded Image Code for use in Google Sheets
# Example:
#
# embedded = '<a data-flickr-embed="true" href="https://www.flickr.com/photos/galtzo/32796076230/in/album-72157679012034441/" title="IMG_2054"><img src="https://c1.staticflickr.com/3/2939/32796076230_773e54a3b0_h.jpg" width="1200" height="1600" alt="IMG_2054"></a><script async src="//embedr.flickr.com/assets/client-code.js" charset="utf-8"></script>'
# extract_embedded_flickr_image_url_for_google_sheets(embedded)
#
def extract_embedded_flickr_image_url_for_google_sheets(embedded, mode: 4, aspect: "4:3", height: nil, width: nil)
options = []
url = embedded[(start = embedded.index("img src=\"https")+9)..(start+embedded[start..(-1)].index("g\" "))]
options << "\"#{url}\""
class Foo
def calls_bar
bar + " from foo"
end
private
def bar
raise "define #{__method__} in subclasses"
end
end
class SubFooPrivateOverride < Foo
@pboling
pboling / unobtrusively_logged.rb
Last active September 26, 2017 09:30
Unobtrusive Debug Logging that examines wonders of Ruby: Module < Class; include Module.new(*args); and more!
# Simpler version of what the debug_logging gem does; see https://github.com/pboling/debug_logging
#
############# THIS IS A BAUBLE
############# FOR EXAMINING SEVERAL OF THE WONDERS OF RUBY
############# TO ACCOMPLISH SOMETHING PRACTICAL
############# For a more robust implementation use the gem debug_logging itself,
############# which makes use of these same principles.
#
# Automatically log Class.method(arguments) as they are called at runtime (instance or singleton)!
#
@pboling
pboling / Gemfile
Created October 13, 2017 21:52
:github macro is slated to become secure HTTPS by default in the Bundler 2.0 release, this is a fix until then
# Fixes :github macro to be secure HTTPS.
# :github macro is slated to become secure HTTPS by default in the Bundler 2.0 release.
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name =~ /\//
"https://github.com/#{repo_name}.git"
end
@pboling
pboling / facebook_throttle.rb
Last active July 10, 2018 14:47
Facebook API Rate Limit Throttler using Sidekiq, does not execute the job inside the lock, to maintain some semblance of performance, just marks it in a counter, which other jobs from the same queue and using the same token will also update, and which will be throttled. Jobs from other queues will not be able to bust the lock until the timer run…
# Mixin to (i.e. include in) any worker class that does FB API calls and should be throttled.
module FacebookThrottle
def perform_throttled(*args, &block)
options = args.extract_options!
user = User.find_by_fb_uid(options[:fb_uid])
if user
if !user.valid_facebook_token? # A bitwise flag managed by flag_shih_tzu gem
puts "Skipping #{self.class} #{user.fb_uid}: Invalid Oauth Token for #{user}"
return false
@pboling
pboling / keybase.md
Last active August 20, 2018 05:56
keybase.md

Keybase proof

I hereby claim:

  • I am pboling on github.
  • I am pboling (https://keybase.io/pboling) on keybase.
  • I have a public key ASC8gzP9Mb-g0_M06lihOvgkD5uFbTrPooaUCSxRT9fIGgo

To claim this, I am signing this object:

@pboling
pboling / rails_single_file.rb
Last active December 1, 2018 16:16 — forked from clupprich/rails_single_file.rb
Rails app w/ tests in a single file
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do
source "https://rubygems.org"
@pboling
pboling / PhantomJS Install.md
Last active July 23, 2019 17:54
How to install old PhantomJS 1.8.2 on Mac OS X
var isDev = false;
if (window.__env.NODE_ENV === 'development') {
isDev = true;
}
if (isDev) {
var MixpanelMock;
MixpanelMock = (function() {
function MixpanelMock() {
this.init = function() {