I hereby claim:
- I am HotFusionMan on github.
- I am hotfusionman (https://keybase.io/hotfusionman) on keybase.
- I have a public key whose fingerprint is 89E6 CD10 2DA8 477B 4251 239D C461 8511 AC18 3574
To claim this, I am signing this object:
#!/bin/bash | |
# From https://www.networkworld.com/article/3620895/what-asking-which-whereis-or-whatis-can-tell-you-about-linux-commands.html , with syntax corrections for macOS X. | |
clear | |
if [ $# == 0 ]; then # if no arguments provided, prompt user | |
echo -n "What command(s) are you asking about?> " | |
read args | |
else | |
args=$* |
# frozen_string_literal: true | |
# This technique learned from https://www.eliotsykes.com/test-rails-rake-tasks-with-rspec . | |
require 'rake' | |
require 'active_support/concern' | |
module TaskExampleGroup | |
extend ActiveSupport::Concern |
json.cache! @available_internal_employees do | |
json.available_internal_employees do | |
json.cache_collection! @available_internal_employees, as: :available_internal_employees do |internal_employees| | |
json.partial! 'agent_dashboard/internal_employee', internal_employee: internal_employees | |
end | |
end | |
end |
#!/bin/bash | |
USER=${1:-sebble} | |
STARS=$(curl -sI https://api.github.com/users/$USER/starred?per_page=1|egrep '^Link'|egrep -o 'page=[0-9]+'|tail -1|cut -c6-) | |
PAGES=$(($STARS/100+1)) | |
echo You have $STARS starred repositories. | |
echo |
I hereby claim:
To claim this, I am signing this object:
def show_controller_action_callbacks | |
_process_action_callbacks.map(&:filter) | |
end | |
alias :action_callbacks :show_controller_action_callbacks | |
def recognize_path(path, environment = { :method => 'GET', :extras => {} }) | |
(@named_routes ||= Rails.application.routes).recognize_path(path, environment) | |
end | |
alias :recognize_route :recognize_path |
# For inclusion into a Rails config/initializers/better_errors.rb file. | |
if defined?(BetterErrors) | |
if ENV['DEV_PROFILING'] == 'true' || ENV['DEV_DISABLE_ERRORS'] == 'true' | |
Rails.configuration.middleware.delete( BetterErrors::Middleware ) | |
end | |
BETTER_ERRORS_EDITORS = { 'x-mine:' => "x-mine://open?file=%{file}&line=%{line}", 'sublime:' => :sublime, 'txmt:' => :textmate, 'emacs:' => :emacs, 'mvim:' => :macvim } | |
if RUBY_PLATFORM.index( 'darwin' ) | |
unless ENV['BETTER_ERRORS_EDITOR'].blank? |
sudo /usr/lib/update-notifier/apt-check --human-readable |
include ActionView::Helpers | |
haml_code = File.open( 'path/to/haml/file' ) { |file| file.read } | |
engine = Haml::Engine.new( haml_code ) | |
puts engine.render |
In the following code, I assume there's a cache_key_for
method defined in ApplicationHelper that's being used by the Rails app to compute the key used for caching the asset
objects. If that isn't the case in your app, you won't need the helper calls, but you'll need to supply whatever code you're actually using for determining cache key values.
controller = ApplicationController.new
controller.expire_fragment(helper.cache_key_for(asset))
include ApplicationHelper
controller = ApplicationController.new
controller.expire_fragment(cache_key_for(asset))