-
Add this to your Rails app's
Gemfile
:gem 'requirejs-rails'
and then run
bundle install
on the command line.
#!/usr/bin/env ruby | |
require 'bundler' | |
gems = ARGV | |
if gems.empty? | |
puts "Updating all gems" | |
Bundler.definition(true) |
Your challenge, should you accept it, is to write a Ruby library that will modify an existing program to output the number of times a specific method is called.
You solution library should be required at the top of the host program, or via ruby's -r flag (i.e. ruby -r ./solution.rb host_program.rb
).
Your solution library should read the environment variable COUNT_CALLS_TO
to determine the method it should count. Valid method signatures are Array#map!
, ActiveRecord::Base#find
, Base64.encode64
, etc.
Your solution library should count calls to that method, and print the method signature and the number of times it was called when the program exits.
Also, your solution should have a minimal impact on the program's running time. set_trace_func
is a no-go...
Inspired by dannyfritz/commit-message-emoji
See also gitmoji.
Commit type | Emoji |
---|---|
Initial commit | 🎉 :tada: |
Version tag | 🔖 :bookmark: |
New feature | ✨ :sparkles: |
Bugfix | 🐛 :bug: |
#!/usr/bin/env bash | |
# --slave /usr/bin/$1 $1 /usr/bin/$1-\${version} \\ | |
function register_clang_version { | |
local version=$1 | |
local priority=$2 | |
update-alternatives \ | |
--install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-${version} ${priority} \ |
Below are a list of System Preference pane URLs and paths that can be accessed with scripting to assist users with enabling macOS security settings without having to walk them through launching System Preferences, finding panes, and scrolling to settings. Not all panes have an accessible anchor and some are OS specific.
To find the Pane ID of a specific pane, open the System Preferences app and select the desired Preference Pane. With the pane selected, open the ScriptEditor.app and run the following script to copy the current Pane ID to your clipboard and display any available anchors:
tell application "System Preferences"
set CurrentPane to the id of the current pane
set the clipboard to CurrentPane