Skip to content

Instantly share code, notes, and snippets.

@Donavan
Donavan / chat_log.md
Created May 16, 2023 23:31
Chunking for summarization

Conversation

  • conversationId: acfa33fb-d353-4ca0-8fb2-23867ea4514c
  • endpoint: openAI
  • title: Python Text Token Counting
  • exportAt: 19:29:58 GMT-0400 (Eastern Daylight Time)

Options

  • endpoint: openAI
  • presetId: null
  • model: gpt-4
@Donavan
Donavan / replace_image_url.js
Created March 19, 2021 20:35
Dealing with blob URLs for images in automation
# This code can be executed in selenium via a javascript executor. It will change the source of an image that uses a blob to a data url instead
# You will need to supply the ID of the image tag, or change to code to look it up some other way.
# This line needs changed / passed in
var image = document.getElementById(YOUR_IMAGE_ID);
var blobUrl = image.src;
var xhr = new XMLHttpRequest;
xhr.responseType = 'blob';
@Donavan
Donavan / desklkist.txt
Created April 19, 2019 21:33
Eternal Hunger
3 Ajani's Pridemate (M19) 5
10 Plains (M19) 261
1 Isolated Chapel (DAR) 241
2 Legion Lieutenant (RIX) 163
10 Swamp (M19) 269
2 Skymarch Bloodletter (XLN) 124
2 Inspiring Cleric (XLN) 16
3 Call to the Feast (XLN) 219
2 Epicure of Blood (M19) 95
1 Herald of Faith (M19) 13
@Donavan
Donavan / decklist
Created April 16, 2019 00:54
Budgetish red deck - Mr Burns
4 Ghitu Lavarunner (DAR) 127
4 Wizard's Lightning (DAR) 152
4 Fanatical Firebrand (RIX) 101
3 Lightning Strike (XLN) 149
21 Mountain (RIX) 195
4 Shock (M19) 156
4 Viashino Pyromancer (M19) 166
3 Goblin Chainwhirler (DAR) 129
1 Risk Factor (GRN) 113
4 Skewer the Critics (RNA) 115
@Donavan
Donavan / Cascade Rage Quit
Created March 2, 2019 23:30
Rev 2 Cascade
1 Conclave Guildmage (GRN) 162
4 Sunpetal Grove (XLN) 257
2 Leonin Warleader (M19) 23
2 Divine Visitation (GRN) 10
11 Plains (RIX) 192
8 Forest (RIX) 196
3 Ajani's Welcome (M19) 6
4 Impassioned Orator (RNA) 12
3 Ixalan's Binding (XLN) 17
2 Healer's Hawk (GRN) 14
1 Conclave Guildmage (GRN) 162
4 Sunpetal Grove (XLN) 257
2 Leonin Warleader (M19) 23
2 Divine Visitation (GRN) 10
11 Plains (RIX) 192
8 Forest (RIX) 196
2 Talons of Wildwood (M19) 202
3 Ajani's Welcome (M19) 6
2 Impassioned Orator (RNA) 12
3 Ixalan's Binding (XLN) 17
@Donavan
Donavan / merge_json.rb
Created November 28, 2018 18:32
Merge cucumber json
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'json'
require 'yaml'
require 'pry'
def remove_backgrounds(features)
features.each do |feature|
scenarios = feature['elements']
@Donavan
Donavan / with_date_picker open.xml
Last active July 18, 2018 16:39
Appium Date picker
<?xml version="1.0" encoding="UTF-8"?>
<XCUIElementTypeApplication type="XCUIElementTypeApplication" name="Marketing" label="Marketing" enabled="true" visible="true" x="0" y="0" width="768" height="1024">
<XCUIElementTypeWindow type="XCUIElementTypeWindow" enabled="true" visible="true" x="0" y="0" width="768" height="1024">
<XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" x="0" y="0" width="768" height="1024">
<XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" x="0" y="0" width="768" height="1024">
<XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" x="0" y="0" width="768" height="1024">
<XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" x="0" y="0" width="768" height="64"/>
<XCUIElementTypeOther type="XCUIElementTypeOther" enabled="true" visible="false" x="0" y="0" width="320" height="1024">
<XCUIElementTypeNavigationBar type="XCUIElement
# frozen_string_literal: true
require 'cpt_hook'
require 'page-object/accessors'
# Rubocop has problems with metaprogramming.
module PageObject
module Platforms
module Watir
#
@Donavan
Donavan / wtf.rb
Last active December 3, 2017 00:20
PageObject Weirdness
# Monkey patching PageObject to add to the DSL like this works
module PageObject
module Accessors
def text_field_hooked(name, identifier={:index => 0}, &block)
standard_methods(name, identifier, 'text_field_for', &block)
define_method(name) do
self.send("#{name}_element").value
end
define_method("#{name}=") do |value|
self.send("#{name}_element").value = value