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
@pboling
pboling / BrokenExample.md
Last active May 14, 2023 07:10
Github Markdown Light & Dark Themed Logo SVG

Change your Github Settings > Appearance > Theme (light to dark, or dark to light) and reload this page! You will note that none of these solutions work!

@pboling
pboling / Procfile
Last active October 31, 2022 16:03
sidekiq initializer
web: bundle exec rails server puma -p $PORT -e $RACK_ENV
critical: env HEROKU_PROCESS=critical bundle exec sidekiq -c 2 -q critical,4
default: env HEROKU_PROCESS=default bundle exec sidekiq -c 4 -q default,2
low: env HEROKU_PROCESS=low bundle exec sidekiq -c 1 -q low,1
@pboling
pboling / Gemfile
Last active March 1, 2022 10:18
My latest project's Gemfile, implements bundle group pattern
source 'https://rubygems.org'
# Follows the bundler group pattern described here:
# http://iain.nl/getting-the-most-out-of-bundler-groups
# Gemfile.mine in root dir allows locally custom gems.
# NOTE: Doing this will change the Gemfile.lock - commit with care.
eval File.read(File.join(File.dirname(__FILE__), 'Gemfile.mine')) if File.exists? File.join(File.dirname(__FILE__), 'Gemfile.mine')
ruby '1.9.3'
@pboling
pboling / ansi_highlight.rb
Created July 20, 2021 20:58
Colorized ansi_highlight
# frozen_string_literal: true
require "colorized_string"
String.class_eval do
# Adapted from the Rails highlight text helper.
# http://api.rubyonrails.org/classes/ActionView/Helpers/TextHelper.html#method-i-highlight
#
# NOT FOR USE WITH HTML (use the Rails standard one for that)
#
@pboling
pboling / Emoji Monospace Test.md
Created March 25, 2021 23:01
Emoji Monospace Test

A markdown table that I want to be aligned; alas, it is impossible!

👷👷👷 📬📬📬 💚💚💚 🚢🚢🚢 ✅✅✅ 🔀🔀🔀 🚀🚀🚀 ⬇️⬇️⬇️ 💨💨💨
123456 123456 123456 123456 123456 123456 123456 123456 123456

Not even an attempt to pad with other characters works because the emoji are not even a multiple of the monospaced width.

| 👷👷👷0 | 📬📬📬0 | 💚💚💚0 | 🚢🚢🚢0 | ✅✅✅0 | 🔀🔀🔀0 | 🚀🚀🚀0 | ⬇️⬇️⬇️0 | 💨💨💨0 |

var isDev = false;
if (window.__env.NODE_ENV === 'development') {
isDev = true;
}
if (isDev) {
var MixpanelMock;
MixpanelMock = (function() {
function MixpanelMock() {
this.init = function() {
@pboling
pboling / PhantomJS Install.md
Last active July 23, 2019 17:54
How to install old PhantomJS 1.8.2 on Mac OS X
@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 / 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 / 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