| Key | Result |
|---|---|
v |
select |
y |
copy (yank) |
c |
change |
d |
delete |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| tmux new -A -s codex | |
| codex | |
| ttyd -p 7681 -i eth0 -R -O tmux attach-session -t codex -r | |
| # -p 7681 sets the web port. | |
| # -i eth0 binds ttyd to your LAN interface (use wlan0 if on Wi-Fi). | |
| # -R / --readonly disables browser input (no typing/click-to-send-keys). | |
| # -O blocks websocket connections from different origins. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| • - Route state (location.state) is a one-time payload passed during navigation (navigate(..., { state }) or <Link state={...}>). | |
| - It does not auto-refresh. | |
| - It can be stale after backend changes. | |
| - It may be missing on direct URL loads/reloads. | |
| - Context state (UserAdminContext) is shared app state provided by UserLinks. | |
| - It is loaded/refreshed from API (fetchUser(userId)). | |
| - It updates over time and is the source of truth for current user data in that section. | |
| - It is consistent across nested admin user pages. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| open_tx = ActiveRecord::Base.connection.open_transactions | |
| Rails.logger.info( | |
| "[TX_DEBUG] before_write user_id=#{user.id} open_transactions=#{open_tx} [/TX_DEBUG]" | |
| ) | |
| user.update!(stripe_customer_id: stripe_customer.id) | |
| Rails.logger.info( | |
| "[TX_DEBUG] after_write user_id=#{user.id} stripe_customer_id=#{User.where(id: user.id).pick(:stripe_customer_id).inspect} " \ | |
| "open_transactions=#{open_tx} rollback_risk=#{open_tx.positive?} [/TX_DEBUG]" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Required Ruby version | |
| bundle exec ruby -e 'puts Gem::Specification.find_by_name("railties").required_ruby_version | |
| # Get revision | |
| Rails.app.revision |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Original Rails controller and action | |
| class EmployeesController < ApplicationController | |
| def create | |
| @employee = Employee.new(employee_params) | |
| if @employee.save | |
| redirect_to @employee, notice: "Employee #{@employee.name} created" | |
| else | |
| render :new | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/Users/aaron/.rubies/arm64/ruby-trunk/bin/ruby | |
| # This is a demo language server for Ruby, written in Ruby. It just checks | |
| # the syntax of Ruby programs when you save them. | |
| # | |
| # Configure this in Vim by adding the vim-lsp plugin, then doing this | |
| # in your vimrc: | |
| # | |
| # au User lsp_setup | |
| # \ lsp#register_server({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| profiler = Thread.new do | |
| while true | |
| p Thread.main.backtrace | |
| sleep 0.5 | |
| end | |
| end | |
| def slow_function | |
| sleep 2 | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # actionpack/lib/action_controller/metal/request_forgery_protection.rb | |
| # Sets the token value for the current session. | |
| def form_authenticity_token(form_options: {}) | |
| masked_authenticity_token(session, form_options: form_options) | |
| end | |
| # Creates a masked version of the authenticity token that varies | |
| # on each request. The masking is used to mitigate SSL attacks | |
| # like BREACH. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # actionview/lib/action_view/helpers/csrf_helper.rb | |
| def csrf_meta_tags | |
| if defined?(protect_against_forgery?) && protect_against_forgery? | |
| [ | |
| tag("meta", name: "csrf-param", content: request_forgery_protection_token), | |
| tag("meta", name: "csrf-token", content: form_authenticity_token) | |
| ].join("\n").html_safe | |
| end | |
| end |
NewerOlder