Skip to content

Instantly share code, notes, and snippets.

View jagthedrummer's full-sized avatar

Jeremy Green jagthedrummer

View GitHub Profile
@jagthedrummer
jagthedrummer / app_boot.rb
Created September 15, 2021 16:25
Bundler runtime modifications of Gemfile.lock
# Point at our Gemfile
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
# load rubygems & bundler
require "rubygems"
require 'bundler/setup' # Sometimes this line triggers modifications to Gemfile.lock
# Set up gems listed in the Gemfile.
Bundler.require(:default, :production)
@jagthedrummer
jagthedrummer / sidekiq_transfer.rake
Created April 5, 2017 19:58
Rake task to transfer Sidekiq jobs from one redis instance to another
# This task should be run inside an environment that is already configured to connect to the redis
# instance that we're transfering AWAY FROM.
#
# The task should be handed the URL of the redis instance that we're MOVING TO.
#
# To run it and pass in the destination Redis you'd do something like this:
# rake sidekiq:transfer[redis://...]
#
# As jobs are added to the destination Redis, they're deleted from the source Redis. This
# allows the task to be restarted cleanly if it fails in the middle due to a network error
@jagthedrummer
jagthedrummer / trace_calls.rb
Created February 15, 2017 19:41
Trace and graph execution path for a method
# Quick and dirty code to drop into a Rails controller to trace execution through code paths and graph it.
# Changing the conditional on line 10 allows you to tweak which classes/directories you see int he graph.
# The trace_calls method could also be used outside a controller like: trace_calls{ do_some_method }
around_action :trace_calls
def trace_calls
g = GraphViz.new( :G, :type => :digraph )
nodes = []
trace = TracePoint.new(:call,:return) do |tp|
if tp.path =~ /clickfunnels\/userpages/ #|| tp.path =~ /clickfunnels\/app/ #|| tp.path =~ /clickfunnels\/lib/
@jagthedrummer
jagthedrummer / Remarq-sample-markdown.md
Created January 15, 2015 19:21
The markdown for the sample reports on Remarq.io

% Remarq Demo Report % Remarq Inc. % January 15, 2015

\sectionTitle

Introduction

Section title pages can contain more content than just a title line.

@jagthedrummer
jagthedrummer / in config.rb
Created August 11, 2014 21:20
Dorking with page titles in MiddleMan
helpers do
def default_title
title = current_page.data.title || @page_title
title
end
def page_title
title = default_title
if title.present?
title += " @ "
@jagthedrummer
jagthedrummer / config.rb
Created June 9, 2014 14:49
config.rb for octolabs.com (Middleman)
###
# Blog settings
###
# Time.zone = "UTC"
activate :blog do |blog|
# This will add a prefix to all links, template references and source paths
blog.prefix = "blogs/octoblog"
var get = Ember.get;
/**
@extends Ember.Mixin
Implements common pagination management properties for controllers.
*/
Ember.PaginationSupport = Ember.Mixin.create({
/**
*/