Skip to content

Instantly share code, notes, and snippets.

def open3_with_timeout(cmd)
#require 'pry'; binding.pry
inp, out, err, wait_thr = Open3.popen3(cmd)
inp.close
did_timeout = false
still_open = [out, err] # Array that only contains the opened streams
output_buffer = ''
stderr_buffer = ''
{
"test_results": {
"aliases": {},
"mappings": {
"cucumber": {
"_timestamp": {
"enabled": true,
"store": true
},
"properties": {
# Rails Stuff
alias stoprails='kill -9 $(lsof -i :3000 -t)'
alias startrails='rails server -d'
alias restartrails='stopRails && startRails'
#Check PHP For Erroes
alias phpcheck='find ./ -name \*.php | xargs -n 1 php -l'
# ROT13-encode text. Works for decoding, too! ;)
alias rot13='tr a-zA-Z n-za-mN-ZA-M'
FROM ubuntu:14.04.3
# Set the locale, otherwise elixir will complain later on
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
# wget for convenience, use curl if you want to
RUN apt-get -y -q install wget
defmodule Web.Team do
use Web.Web, :model
schema "teams" do
field :name, :string
many_to_many :users, join_through: 'team_members', on_delete: :delete_all
timestamps()
end
@doc """
@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
# frozen_string_literal: true
require 'cpt_hook'
require 'page-object/accessors'
# Rubocop has problems with metaprogramming.
module PageObject
module Platforms
module Watir
#
@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
@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']