Skip to content

Instantly share code, notes, and snippets.

@stembrain
stembrain / PhantomJSDriverService.java
Last active August 29, 2015 13:56
How to expose phantomjs default builder so that log location can be modified
/**
* Call this if you need to modify the service before building it, such as
* Builder b = PhantomJsDriverService.createDefaultServiceBuilder(null);
* b.withLogFile(new File("foo.log"));
* b.build();
**/
public static Builder createDefaultServiceBuilder(Capabilities desiredCapabilities){
// Look for Proxy configuration within the Capabilities
Proxy proxy = null;
if (desiredCapabilities != null) {
@stembrain
stembrain / format.js
Created May 25, 2021 20:25
format numbers on the page with commas
var ignoreNodes = new Set(['INPUT', 'TEXTAREA']);
function walk(node) {
if (ignoreNodes.has(node.tagName)) {
return;
}
switch (node.nodeType) {
// Element
case 1:
// Document
case 9:
@stembrain
stembrain / commafy
Created October 13, 2021 20:09
adds commas / international formatting to all numbers on the page. probably has a few small bugs
//thanks to rick maisano
var ignoreNodes = new Set(['INPUT', 'TEXTAREA']);
function walk(node) {
if (ignoreNodes.has(node.tagName)) {
return;
}
switch (node.nodeType) {
// Element
case 1:
// Document