In the console
export SLACK_DEVELOPER_MENU=true
open /Applications/Slack.app
In slack UI
right-click on anything -> inspect element
# in rails_helper.rb | |
driver = if ENV['CHROME_DEBUG'] == 'true' | |
Capybara.register_driver :chrome do |app| | |
Capybara::Selenium::Driver.new(app, browser: :chrome) | |
end | |
:chrome | |
else | |
Capybara.register_driver :headless_chrome do |app| | |
browser_options = ::Selenium::WebDriver::Chrome::Options.new |
name: Ruby | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: |
require 'cgi' | |
require 'json' | |
require 'active_support' | |
def verify_and_decrypt_session_cookie(cookie, secret_key_base = Rails.application.secrets.secret_key_base) | |
cookie = CGI::unescape(cookie) | |
salt = 'encrypted cookie' | |
signed_salt = 'signed encrypted cookie' | |
key_generator = ActiveSupport::KeyGenerator.new(secret_key_base, iterations: 1000) | |
secret = key_generator.generate_key(salt)[0, ActiveSupport::MessageEncryptor.key_len] |
export SLACK_DEVELOPER_MENU=true
open /Applications/Slack.app
right-click on anything -> inspect element
/* | |
This is a script to take in a {json:api} document (jsonapi.org) | |
and generate a graphviz (http://www.graphviz.org) representation of it. | |
Usage: | |
> node <this_file> | |
then copy and paste the output to some graphviz parser | |
e.g. http://www.webgraphviz.com or http://gravizo.com | |
*/ |
# Prevent wiping out data in non-test environments | |
raise "Test should be run in 'test' environment only" if Rails.env != 'test' | |
module DynamoidReset | |
def self.all | |
Dynamoid.adapter.list_tables.each do |table| | |
# Only delete tables in our namespace | |
if table =~ /^#{Dynamoid::Config.namespace}/ | |
Dynamoid.adapter.delete_table(table) | |
end |
require 'nokogiri' | |
require 'open-uri' | |
require 'pry' | |
require 'yaml' | |
class Crawl | |
def initialize(start_url = "http://sm-11.herokuapp.com") | |
@start_url = start_url | |
@guides = [] | |
end |
The print_graph
method displays the Smart Answer as a tree.
The print_questions_and_possible_next_nodes
method displays the questions and their possible next nodes.
The extraction of possible next nodes is horrible in the case where the Smart Answer uses the block syntax of next_node
. I'm getting the source of the block and extracting things that look like symbols.
-----BEGIN PGP PUBLIC KEY BLOCK----- | |
mQINBFVsoucBEACcPaABLP8Hm6b0R5wcZjsLsyTfrgGwC1mKsGSvoFa8Lu4d9moa | |
xsyWWO1NdIMMB7UNtlB1sbnFI0mkAiZoRVpk+hdYx9UvPup/exfbsKZWMG2srCvJ | |
cjL36X5jeGbu3X/78zAlPXlKhvJLf1i+8aMgQheO6He+D8Xu5G1QrCqYPaoEWgER | |
xQrUxu01S25ziwaf/7VvY3C35hKrQL7JG4N1mOL+QjxMRIzrVXe7mL7Igm7rT5Oz | |
tQtgfeMc4piTKQaztNbP+Yj+6LdoqeIzs3NWlFxfSqYw2qWrDIAqJlfpwMn/MWGN | |
r/8skOuCjBYPffDgngayAJrNhjeTlY5u++A41Cx84NhnMH93WpZd+Q7ga12QvRPc | |
U5/F2IBj/8eaSucKrgOL1KREo2JLS+8/Xp8lgJJNDzRkWhfMAqJnz7F8UwJs3DNW | |
XkLgKBxZobwztoxVWXgLhm78hwQ1vJLQbGlcFM9wbJzuLLRONniK0Rhx4Kuu0Zn2 |
def find_keys(hash) | |
hash.flat_map do |key, value| | |
if value.is_a?(Hash) | |
find_keys(value) | |
else | |
key | |
end | |
end | |
end |