Skip to content

Instantly share code, notes, and snippets.

Avatar
🙃

Bobby McDonald BobbyMcWho

🙃
View GitHub Profile
@BobbyMcWho
BobbyMcWho / somewhere_in_update_script.rb
Last active May 19, 2020
Some code to create `Dependabot::SecurityAdvisory`s for use in dependabot-core scripts
View somewhere_in_update_script.rb
# See: https://github.com/dependabot/dependabot-script/blob/master/update-script.rb
# Other update script logic
vulnerabilities = VulnerabilityFetcher.new(dependency_names, package_manager).fetch_advisories
# Note you may not just want top level depending on your use case
dependencies.select(&:top_level?).each do |dep|
security_vulnerabilities = []
if vulnerabilities.any?
security_vulnerabilities = vulnerabilities[dep.name.to_sym].map do |vuln|
@BobbyMcWho
BobbyMcWho / ruby-debug.md
Last active Sep 27, 2019
Debugging Ruby locally in VSCode using ruby-debug and native breakpoints
View ruby-debug.md

In the extensions marketplace, search "ruby-debug" and install globally. You may need to reload your workspace afterwards.

You'll need to add readapt to your project's gemfile and bundle install.

group :development do 
  # gems...
  gem 'readapt' # Debugging with vscode ruby-debug extension
@BobbyMcWho
BobbyMcWho / _libxml2_error.md
Last active Sep 12, 2018
libxml2 bug when validating against a complexType in an XSD
View _libxml2_error.md

I came across this error when validating XML files against an XSD in Nokogiri.

When validating a complexType XML element, if a node fails validation due to a Occurence restriction, and it is the last node in the complex element, the validation error will not raise, and will pass as a valid document. If there is another node in the sequence that is allowed, then at that point the document will fail validation. However, the error that is thrown is misleading, because it will say that the second element is the one that is out of place, rather than the one that is actually out of place.

The easiest way to reproduce this is with xmllint:

$xmllint --noout --schema example_xsd.xsd incorrectly_passing.xml
incorrectly_passing.xml validates
View keybase.md

Keybase proof

I hereby claim:

  • I am bobbymcwho on github.
  • I am bobbymcwho (https://keybase.io/bobbymcwho) on keybase.
  • I have a public key ASBLy5Vbk00319-ZDn5u38bHLlTnhYEBFKH-NQzq5Zd4Xwo

To claim this, I am signing this object:

You can’t perform that action at this time.