Skip to content

Instantly share code, notes, and snippets.

Kevin Pheasey kpheasey

Block or report user

Report or block kpheasey

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
kpheasey / active_record_extension.rb
Last active Aug 29, 2015
SELECT SUM and SELECT SUM CASE ActiveRecord methods
View active_record_extension.rb
module ActiveRecordExtension
extend ActiveSupport::Concern
module ClassMethods
# Add a SELECT SUM() by CASE to query.
# @param cases [Hash(:attr, :val, :operand), Array(Hash(:attr, :val, :operator))]
# @param sum_field [Symbol, String]
kpheasey / 0000_packages.config
Last active Sep 16, 2019 — forked from gcarrion-gfrmedia/0000_packages.config
AWS Elastic Beanstalk Ruby 2.2 Puma Sidekiq
View 0000_packages.config
git: []
htop: []
kpheasey /
Last active Jan 31, 2018
DO Ubuntu 14.04 Droplet to ARK Server
# Updating Ubunut
echo "updating ubunutu... please be patient"
apt-get update && apt-get upgrade -y
echo "installing required packages... please be patient"
apt-get install htop lib32gcc1 -y
# Create steam user if needed
kpheasey /
Last active Oct 1, 2015
Magento Permissions
#Set Magento root directory permissions. Call using the following:
# curl -sL | sudo bash
if [ ! -f ./app/etc/local.xml ]; then
echo "-- ERROR"
echo "-- This doesn't look like a Magento install. Please make sure"
echo "-- that you are running this from the Magento main doc root dir"
kpheasey /
Last active Oct 6, 2015
RailsScript Infinite Scroll
window.App ||= {}
class App.GemgentoCategories extends App.Base
show: =>
new App.ProductGrid()
View rsvp_sxsw_controller.rb
# app/controllers/rsvp_sxsw_controller.rb
class RsvpSxswController < ApplicationController
# GET /rsvp_sxsw
def new
kpheasey / sidekiq.rake
Created Feb 11, 2016
Sidekiq Pro Reliability & Unique Jobs - merge stale private queues and clear unique locks
View sidekiq.rake
namespace :sidekiq do
task merge_stale_queues: :environment do
ec2_private_ips ||= 'us-west-2') { |instance| instance.private_ip_address }
merged = false
puts "EC2 Private IPs: #{ec2_private_ips}"
Sidekiq.redis do |conn|
private_queues = conn.keys('queue:*_*_*')
kpheasey /
Last active Jul 20, 2019
WSL, RVM & RubyMine; ubuntu on windows, bash on windows

Add inbound firewall rule for TCP 2222

  • Windows 10 has 2 new services, SSH Server Proxy and SSH Server Broker which will already be bound to port 22
  • Do not allow public connection on this rule, WSL is not proven safe


Add as cmd startup with bash.exe --login

Install the SSH server and some Rails essentials libraries in bash

sudo apt-get update && sudo apt-get upgrade -y
View models.rb
class Order < ApplicationRecord
belongs_to :customer
def totals_by_customer
Order.all.pluck(:customer) do |customer|
[customer, customer.orders.sum(:total))]
kpheasey / gdb_output.txt
Created Jan 31, 2017
sidekiq process freeze
View gdb_output.txt
Thread 22 (Thread 0x7fa34f0b0700 (LWP 12916)):
#0 0x00007fa34e72afdd in poll () at ../sysdeps/unix/syscall-template.S:81
#1 0x00007fa34eba6fbc in ?? () from /usr/lib/x86_64-linux-gnu/
#2 0x00007fa34e428184 in start_thread (arg=0x7fa34f0b0700) at pthread_create.c:312
#3 0x00007fa34e73837d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
Thread 21 (Thread 0x7fa346635700 (LWP 12937)):
#0 0x00007fa34e72fc53 in select () at ../sysdeps/unix/syscall-template.S:81
#1 0x00007fa34eba67d0 in rb_thread_fd_select () from /usr/lib/x86_64-linux-gnu/
#2 0x00007fa34ea9edaf in ?? () from /usr/lib/x86_64-linux-gnu/
You can’t perform that action at this time.