Skip to content

Instantly share code, notes, and snippets.

@dmitrym0
dmitrym0 / gist:8545228
Created January 21, 2014 18:18
A selenium webdriverjs test that hangs getting element text
var assert = require('assert'),
test = require('selenium-webdriver/testing'),
webdriver = require('selenium-webdriver'),
SeleniumServer = require('selenium-webdriver/remote').SeleniumServer;
var driver = new webdriver.Builder().
usingServer("http://localhost:9515").
withCapabilities(webdriver.Capabilities.chrome()).
build();
@dmitrym0
dmitrym0 / gist:8545862
Last active January 4, 2016 01:08
Timeout on text()
require('colors');
wd = require('wd');
var browser = wd.promiseChainRemote('http://localhost:9515/');
browser.on('status', function(info) {
console.log(info.cyan);
});
it "throws an error if bookguid has been reused" do
payload = {:bookGuid => "ABC123", :backingFile=> "/tmp/test.epub", :previewPercentage => "10", :queueItemId => SecureRandom.uuid};
Rm::Api::OnboardingController.any_instance.stubs(:does_guid_exist?).returns(true)
get :onboarding, payload
response.status.should == 400
json = JSON.parse(response.body)
json["ErrorCode"].should include "DUPLICATE_GUID"
end
@dmitrym0
dmitrym0 / gist:11154340
Created April 21, 2014 19:52
Moving cursor around with watir-webdriver and Selenium Actionbuilder.
require 'watir-webdriver'
browser = Watir::Browser.new :chrome
browser.goto 'http://html5demos.com/canvas-grad'
element = browser.driver.find_element(:tag_name, 'canvas')
browser.driver.action.move_to(element, 10, 10).perform
sleep 1
browser.driver.action.move_to(element, 100, 100).perform
sleep 1
browser.driver.action.move_to(element, 500, 500).perform
sleep 1
@dmitrym0
dmitrym0 / webaudio mock
Created February 18, 2015 19:55
Simple webaudio mock.
<script>
// readium webaudio mock
var Audio = function() {
return {
load: function() {},
play: function() {},
addEventListener:function() {},
pause:function() {},
}
}
@dmitrym0
dmitrym0 / Vagrantfile
Last active August 29, 2015 14:22 — forked from ziadoz/Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Box.
config.vm.box = "trusty64"
config.vm.network :private_network, ip: "192.168.33.100"
@dmitrym0
dmitrym0 / The Technical Interview Cheat Sheet.md
Last active March 20, 2020 20:17 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@dmitrym0
dmitrym0 / docker-compose.yml
Created October 22, 2015 16:35
Attempt to create a docker image with bundle caching
bundle:
image: phusion/passenger-full
env_file:
- '.env.web'
volumes:
- /bundle-volume
web:
build: .
volumes:
@dmitrym0
dmitrym0 / watir.rb
Created March 1, 2016 04:13
scribbles with watir
require 'watir-webdriver'
browser = Watir::Browser.new :chrome
browser.goto 'http://intridea.github.io/sketch.js/'
sleep 3
element = browser.driver.find_element(:tag_name, 'canvas')
browser.driver.action.move_to(element, 10, 10).click_and_hold.perform
sleep 1
browser.driver.action.move_to(element, 100, 100).perform
sleep 1
browser.driver.action.move_to(element, 110, 50).perform
version: '2'
services:
wordpress:
image: wordpress:4.7-apache
volumes:
- "/var/blog/wordpress:/var/www/html"
environment:
WORDPRESS_DB_PASSWORD: passwordd