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
| #!/bin/bash | |
| # adapted from https://gist.github.com/citruz/9896cd6fb63288ac95f81716756cb9aa | |
| # See also https://www.qemu.org/docs/master/system/invocation.html | |
| # highmem must be off with Apple M1 and this limits the memory unfortunately | |
| qemu-img create -f qcow2 ubuntu-24.qcow2 10G | |
| dd if=/dev/zero conv=sync bs=1m count=64 of=ovmf_vars.fd | |
| qemu-system-aarch64 \ |
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
| require 'capybara/dsl' | |
| module TestConsole | |
| if(defined?(Rails) && Rails.env.test?) | |
| whitelist = %w(chrome firefox) | |
| print "Browser [#{whitelist.join('|')}] (enter to skip): " | |
| browser = gets.strip | |
| if whitelist.include?(browser) |
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
| #!/usr/bin/ruby | |
| ################################################################################ | |
| # A quick script to grab all the tests from JIRA via the REST API. | |
| # Docs are here: https://docs.atlassian.com/jira/REST/cloud/ | |
| # |
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
| LOG_DIR = Rails.root.join('log') | |
| LOG = Logger.new(File.join(LOG_DIR, "turnip_#{Time.now.strftime("%Y%m%d%H%M")}.log")) | |
| LOG.level = Logger::DEBUG | |
| RSpec.configure do |config| | |
| config.before(:each) do | scenario | | |
| LOG.info("========================================") | |
| LOG.info("Starting test #{scenario.example_group.description}") | |
| 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
| def reload_page | |
| page.evaluate_script("window.location.reload()") | |
| end | |
| # Reload the page until either you hit the timeout, or the selector appears | |
| # For use in places where the basic page.has_selector? wait won't work without | |
| # reloading the whole page | |
| # | |
| # Accepts the same options as Capybara::Node::Matchers#has_selector? | |
| def reload_until(*selector_args) |
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 from http://snippets.dzone.com/posts/show/4468 by MichaelBoutros | |
| # | |
| # Optimized version which uses to_yaml for content creation and checks | |
| # that models are ActiveRecord::Base models before trying to fetch | |
| # them from database. | |
| namespace :db do | |
| namespace :fixtures do | |
| desc 'Dumps all models into fixtures.' | |
| task :dump => :environment do | |
| models = Dir.glob(RAILS_ROOT + '/app/models/**.rb').map do |s| |
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
| // International Chemical Identifier Regex, by lo sauer - lsauer.com | |
| // Morphine InchI: | |
| var x="InChI=1S/C17H19NO3/c1-18-7-6-17-10-3-5-13(20)16(17)21-15-12(19)4-2-9(14(15)17)8-11(10)18/h2-5,10-11,13,16,19-20H,6-8H2,1H3/t10-,11+,13-,16-,17-/m0/s1" | |
| // applying an organic character-subset | |
| // we could check for the length property, but in case of 0 matches 'null' is returned -> hence !!.. \ generally equal to Boolean(..) | |
| !!x.trim().match(/^((InChI=)?[^J][0-9BCOHNSOPrIFla+\-\(\)\\\/,pqbtmsih]{6,})$/ig) | |
| >true | |
| //generic: | |
| x.trim().match(/^((InChI=)?[^J][0-9a-z+\-\(\)\\\/,]+)$/ig) |