Skip to content

Instantly share code, notes, and snippets.

View remarkablemark's full-sized avatar

Mark remarkablemark

View GitHub Profile
{
"scripts": {
"start": "node webdriverjs-set-binary"
},
"dependencies": {
"selenium-webdriver": "^3.6.0"
},
"engines": {
"node": ">=8",
"npm": ">=6"
@remarkablemark
remarkablemark / copy.js
Last active June 20, 2016 07:10
Modularizing gulp.
'use strict';
const gulp = require('gulp');
gulp.task('copy', () => {
return gulp
.src('./hello.js')
.pipe(gulp.dest('./copy/'));
});
@remarkablemark
remarkablemark / rerequire.js
Created June 21, 2016 15:23
Reload a node module by deleting the cache reference in require.
'use strict';
/**
* Re-require a module.
*
* @param {String} path - The module path.
* @return {*} - The module export.
*/
module.exports = function rerequire(path) {
try {
@remarkablemark
remarkablemark / webdriverjs_parallel_flows.js
Created June 27, 2016 20:41
Setting a cookie with WebDriverJS with parallel flows.
'use strict';
/**
* Module dependencies.
*/
const webdriver = require('selenium-webdriver');
/**
* Run clients in parallel and set cookie.
* https://github.com/SeleniumHQ/selenium/blob/master/javascript/node/selenium-webdriver/example/parallel_flows.js
@remarkablemark
remarkablemark / webdriverjs_localstorage.js
Created June 28, 2016 19:18
Get and set localStorage with WebDriverJS `executeScript` and `executeAsyncScript`.
'use strict';
/**
* Module dependencies.
*/
const webdriver = require('selenium-webdriver');
/**
* Build driver.
*/
@remarkablemark
remarkablemark / webdriverjs_parallel_drivers.js
Created June 29, 2016 16:48
Run multiple browsers in parallel using WebDriverJS flow.
'use strict';
/**
* Module dependencies.
*/
const webdriver = require('selenium-webdriver');
/**
* Open each driver in parallel.
*
@remarkablemark
remarkablemark / es6-export-function-hoisting.js
Created June 29, 2016 19:19
When exporting a declared function in ES6, the function will be hoisted to the top.
'use strict';
// this will not break and log "foo"
foo();
// function declaration will be hoisted to the top
// http://stackoverflow.com/questions/7609276/javascript-function-order-why-does-it-matter#answer-7610883
export function foo() {
console.log('foo');
}
@remarkablemark
remarkablemark / docker-quickstart-terminal.md
Created July 4, 2016 19:40
Docker Quickstart Terminal on Mac OS X.

Docker Quickstart Terminal

Default Terminal:

# set default to Terminal
echo Terminal > ~/Library/Application Support/DockerToolbox/default_terminal

# or iTerm2
echo iTerm > ~/Library/Application Support/DockerToolbox/default_terminal
@remarkablemark
remarkablemark / Dockerfile
Last active March 25, 2026 14:35
Install node and npm with nvm using Docker.
# set the base image to Debian
# https://hub.docker.com/_/debian/
FROM debian:latest
# replace shell with bash so we can source files
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# update the repository sources list
# and install dependencies
RUN apt-get update \