Skip to content

Instantly share code, notes, and snippets.

@hallvors
hallvors / test_geterrorlog.py
Created December 8, 2015 18:17
Boar test: get errorlog
import json
import os
import requests
import sys
import time
import unittest
# URL of SlimerJS / PhantomJS server
url = os.getenv('COMPATIPEDE_TAB_URL', 'http://192.168.1.6:8778')
@hallvors
hallvors / test__plugins__window_orientation.py
Created December 8, 2015 18:15
Boar test example: testing the window.orientation plugin
import json
import os
import requests
import sys
import time
import unittest
from ../shared_config import do_command
class TestConsoleLogging(unittest.TestCase):
@hallvors
hallvors / test_compare_css.py
Created November 27, 2015 14:24
Jannah client to compare CSS problem reports
import requests
import json
import sys
import time
import pdb
import argparse
def do_command(url, command, data={}):
print "executing %s/%s\n" % (url, command),
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
@hallvors
hallvors / css-analysis.js
Created November 27, 2015 14:23
CSS -webkit- style enumeration script
function(){
/*
Analyses applied CSS and sums up findings
We want to return a list of objects referring to elements
in the page with the following details:
selector: a CSS selector that will match the element (not necessarily the one in the CSS)
index: the index of the element in the selection you get
if you do document.querySelectorAll(selector)
coords: {x: y: width: height: }
problems: [ {property: value: } ]
@hallvors
hallvors / testme.js
Last active November 5, 2015 17:24
Boar testing experiment
"use strict";
var assert = require('assert');
var request = require('request');
require('should');
var serviceURL, released, instance;
//Running simple http server here you can see when tab becomes available
require('http').createServer((req, resp) => {
let body = '';
@hallvors
hallvors / secrets.py
Created October 24, 2015 09:45
Suggested webcompat.com secrets.py.example
# Get the client id and client secret from GitHub if you're part of the webcompat
# organization. Otherwise, create your own test and production applications,
# and take note of the client id and client secret GitHub gives you.
#
# [1]<https://github.com/organizations/webcompat/settings/applications/>
# If you're running this locally, you can ignore PRODUCTION and DEVELOPMENT
# blocks
# Production = webcompat.com
if PRODUCTION:
GITHUB_CLIENT_ID = ""
@hallvors
hallvors / zeroclipboard-html5.js
Created October 20, 2015 22:29
An experimental HTML5 version of ZeroClipboard, API not quite complete yet
(function(window, undefined) {
"use strict";
/* -------->8 above stuff is start.js */
/* -------->8 below stuff is shared/private-html5.js */
var _globalConfig = {};
var _document = window.document,
_Error = Error,
_hasOwn = window.Object.prototype.hasOwnProperty;
@hallvors
hallvors / labels.js
Last active October 21, 2015 20:48
A label list implementation for webcompat.com
/**
* A LabelList is a list of labels. It takes care of all namespace
* prefixing and unprefixing, so that the rest of the app doesn't
* ever need to worry about those details. Just pass in a list
* of labels from the server or a URL.
*/
issues.LabelList = Backbone.Model.extend({
initialize: function() {
this.set('namespaceRegex', /(browser|closed|os|status)-(.+)/i);
this.set('allLabelsURL', '/api/issues/labels'); // see "need a complete list" below
@hallvors
hallvors / queryCommandEnabled.js
Created April 21, 2015 05:29
Exploring queryCommandEnabled() vs onbefore* events
<pre></pre>
<script>
var pre = document.getElementsByTagName('pre')[0];
document.onbeforepaste = document.onbeforecopy = document.onbeforecut = function (e) {
pre.appendChild(document.createTextNode(e.type));
}
for(var cmd in {'copy':1, 'cut':1, 'paste':1}){
pre.appendChild(document.createTextNode('\n\n' + cmd.toUpperCase() + '\n'));
@hallvors
hallvors / slimerjs-quotetest.bat
Last active August 29, 2015 14:19
Testing how Windows handles quoted paths in a batch file
@echo off
setlocal EnableDelayedExpansion
set SLJS_TEST=%SLJS_TEST%
echo.
echo No quotes added. Path is %SLJS_TEST%
echo.