Skip to content

Instantly share code, notes, and snippets.

var template = `
<button aria-label="Cycle Cameras" class="CycleCameraButton hsGJfJ">
<div class="ControlButton__IconWrap-gnUpcI clHgYP">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="#505868">
<path d="M0 0h24v24H0z" fill="none"></path>
<path d="M17 10.5V7c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-3.5l4 4v-11l-4 4z"></path>
</svg>
</div>
<span color="default" class="Text__StyledText-llZFeh kLLMan ControlButton__BottomText-ipkjdR gzpKjG">Cycle Cams</span>
</button>
From cd31be2657d49d1126fba1a75b72d5769e633c0d Mon Sep 17 00:00:00 2001
From: "John F. Douthat" <johndouthat@gmail.com>
Date: Wed, 15 Jul 2020 11:26:31 -0500
Subject: [PATCH] Update primary branch name to trunk
---
Advanced-User-Interactions.md | 4 ++--
Automation-Atoms.md | 2 +-
Continuous-Integration.md | 2 +-
Crazy-Fun-Build.md | 2 +-

Keybase proof

I hereby claim:

  • I am johndouthat on github.
  • I am johndouthat (https://keybase.io/johndouthat) on keybase.
  • I have a public key ASDdC9jctRPKdqaauTOjwmIv-rSTFUUeFO19qG3-8_DitAo

To claim this, I am signing this object:

# A (contrived) example of JOINing on a subquery with ARel/Rails3
# Find orders whose billing or shipping address is 90210:
# Method 1) Raw SQL JOIN:
address_sql = Address.select(:id).where(:zip => 90210).to_sql
address_any = Arel.sql("INNER JOIN (#{address_sql}) addr ON addr.id = orders.shipping_address_id OR addr.id = orders.billing_address_id")
puts Order.joins(address_any).where(:status => 2).to_sql
# SELECT "orders".*
# FROM "orders"
require 'bundler'
Bundler.setup
Bundler.require
key = OpenSSL::Digest::SHA256.new('password').digest
crypt = ActiveSupport::MessageEncryptor.new(key)
encrypted_data = crypt.encrypt_and_sign('my secret data')
# throws CipherError Illegal key size: possibly you need to install Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files for your JRE
~/code/JRUBY-BUGS/7035/seventy_thirty_five $ jruby -v
jruby 1.7.3.dev (1.9.3p327) 2013-01-24 cc9acba on Java HotSpot(TM) 64-Bit Server VM 1.7.0_12-ea-b05 +indy [darwin-x86_64]
~/code/JRUBY-BUGS/7035/seventy_thirty_five $ bundle exec rails server -p 3171
/Users/john/code/jruby/lib/ruby/gems/shared/gems/jruby-openssl-0.8.2/lib/shared/jruby-openssl.rb:16 warning: already initialized constant PKCS1_PADDING
/Users/john/code/jruby/lib/ruby/gems/shared/gems/jruby-openssl-0.8.2/lib/shared/jruby-openssl.rb:16 warning: already initialized constant SSLV23_PADDING
/Users/john/code/jruby/lib/ruby/gems/shared/gems/jruby-openssl-0.8.2/lib/shared/jruby-openssl.rb:16 warning: already initialized constant NO_PADDING
/Users/john/code/jruby/lib/ruby/gems/shared/gems/jruby-openssl-0.8.2/lib/shared/jruby-openssl.rb:16 warning: already initialized constant PKCS1_OAEP_PADDING
/Users/john/code/jruby/lib/ruby/gems/shared/gems/jruby-openssl-0.8.2/lib/shared/jruby-openssl.rb:16 warning: already initialized constant UNIVERSAL_TAG_NAME
/U
# Show the full path (so that rails-stacktrace-textmate-linker-greasemonkey-script works)
# https://github.com/rails/rails/blob/master/railties/lib/rails/backtrace_cleaner.rb#L10
Rails.backtrace_cleaner.remove_filters!
Rails.backtrace_cleaner.remove_silencers!
Rails.backtrace_cleaner.add_silencer { |line| line !~ /^#{Rails.root}\/(app|config|lib|test)/ }
# Remove the render template pattern (which whould be done, but it may be a bug in RENDER_TEMPLATE_PATTERN)
Rails.backtrace_cleaner.add_filter { |line| line.sub(/:in `(block.+)?_app_views_\w+'/, '') }
class ActiveRecord::ConnectionAdapters::JdbcAdapter
# like jdbc_select_all, but adds a method, `#metadata`, which returns metadata about the result
#
# TODO: wrap select_all_with_metadata with withConnectionAndRetry (!)
# TODO: use a less-hacky method for attaching the metadata
# TODO: rename?
def jdbc_select_all_with_metadata(sql, name = nil, binds = [])
sql = substitute_binds(sql, binds)
if name == :skip_logging
require 'rubygems'
require 'rotp' # `gem install rotp`
require 'cgi'
secret = ROTP::Base32.random_base32
totp = ROTP::TOTP.new(secret)
uri = totp.provisioning_uri("MyUsername")
qr_code_uri = "http://chart.apis.google.com/chart?cht=qr&chs=250x250&chl=" + CGI.escape(uri)
system('open', qr_code_uri)
@johndouthat
johndouthat / gist:2258722
Created March 31, 2012 02:25
fun_game.rb
def pick6
6.times.map { rand(99) }
end
require 'curses'
include Curses
def show_message(message)
setpos(0,0)
addstr(message)