Skip to content

Instantly share code, notes, and snippets.

View cvrebert's full-sized avatar

Chris Rebert cvrebert

View GitHub Profile
@cvrebert
cvrebert / cr_csv.js
Last active January 29, 2022 02:19
Consumer Reports grid to CSV
// 1. View: Full View
// 2. Scroll to bottom of page until all entries are lazy-loaded.
function downloadCSV(content) {
let filename = 'CR_' + (new Date()).toISOString().replaceAll(/[T:.]/g, '_') + '.csv';
let a = document.createElement('a');
a.download = filename;
a.href = 'data:text/csv,' + content; // TODO: %-encode
a.click();
}
@cvrebert
cvrebert / wat.md
Last active February 11, 2016 09:53
HTML focus events
Index: appe.xml
===================================================================
--- appe.xml (revision 2813)
+++ appe.xml (working copy)
@@ -8,7 +8,7 @@
bugs. They're still good instructions, and are referenced from <xref
linkend="users-to-volunteers"/><phrase output="printed"> in <xref
linkend="managing-volunteers"/></phrase>. But as they are a living
-document, I felt it didn't make sense to include a frozen snaphot of
+document, I felt it didn't make sense to include a frozen snapshot of
@cvrebert
cvrebert / Main.java
Created April 14, 2015 07:03
Trying to get createdAt of an MkComment throws IllegalStateException
import java.io.IOException;
import java.util.Date;
import com.jcabi.github.*;
import com.jcabi.github.mock.*;
public class Main {
public static void main(String[] args) throws IOException {
Github gh = new MkGithub("mock_gh");
Comment cmt = gh
.repos().create(javax.json.Json.createObjectBuilder().add("name", "foobar").build())
@cvrebert
cvrebert / Main.java
Created April 13, 2015 21:01
jcabi MkGithub example code no longer compiles
package qux;
import java.io.IOException;
import com.jcabi.github.*;
import com.jcabi.github.mock.*;
public class Main {
public static void main(String[] args) {
Github github = null;
try {
@cvrebert
cvrebert / css_regression_testing.md
Last active May 9, 2023 12:13
Survey of screenshot-based CSS testing tools

Currently considering https://github.com/webdriverio/webdrivercss


Core Goals:

  • Can test in up-to-date versions of all major browsers
  • Can test on up-to-date versions of all major OSes
  • Can test in IE9 (because Bootstrap v4 will support IE9+)
  • Don't want to have to setup/maintain our own cluster of VMs running all the necessary OSes (and all the versions of Windows)
  • Workflow for management of reference/baseline/norm screenshots
@cvrebert
cvrebert / survey.md
Last active July 5, 2022 16:20
Click and focus behavior across browsers & OSes

Test apparatus: http://jsfiddle.net/hRub4/

(Windows = Windows 8.1 desktop)

  • Windows Chrome 39
    • Button focuses on click and via keyboard tabbing
    • Anchor focuses on click and via keyboard tabbing
  • Windows Firefox 30.0
    • Button focuses on click and via keyboard tabbing
    • Anchor focuses on click and via keyboard tabbing
  • Windows Internet Explorer 11
@cvrebert
cvrebert / auto_twitchplayspokemon.js
Created February 17, 2014 10:40
Automatic participant for TwitchPlaysPokemon
// This is super-hacky since it's 2am.
function press(button) {
$("#chat_text_input").val(button);
$('#chat_speak').click();
}
var silence = false;
var xPos = 0;
var yPos = 0;
var aaa = 0;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="../../assets/ico/favicon.ico">
@cvrebert
cvrebert / pokecrack.py
Created January 19, 2012 02:54
So, I took CSE 127...
#!/usr/bin/env python
# Background: http://cses.ucsd.edu/pokemon/ & http://cseweb.ucsd.edu/classes/fa11/cse127-a/
from urllib import urlopen, urlencode
url = "http://cses.ucsd.edu/pokemon/submitemail.php"
for n in range(1, 1000):
data = urlencode({"email":"YourUsernameHere@ucsd.edu", "pokemonid":str(n), "submit":"Catch!"})
f = urlopen(url, data)
result = f.read()
f.close()
print(result) # if you want