Skip to content

Instantly share code, notes, and snippets.

View adregan's full-sized avatar
🛶
My other car is a canoe

Duncan Regan adregan

🛶
My other car is a canoe
View GitHub Profile
// stashes the box
var box = document.getElementById('box');
// Sets a 1 ms interval to call clickThemAll()
setInterval(clickThemAll, 1);
// Clicks the play button to start the game
document.querySelector('.play-btn').click();
function clickThemAll(){
//grabs the children, sets prevBG to false, stores length
var children = box.querySelectorAll('span')
module.exports = function(counter) {
var duplexer = require('duplexer')
, through = require('through')
, thr = through(write)
, countries = {}
;
return duplexer(thr, counter);
function write(buf) {
import { Actions, Store, Flux } from 'flummox';
class MessageActions extends Actions {
newMessage(content) {
return content; // automatically dispatched
}
}
class MessageStore extends Store {
constructor(flux) {
@adregan
adregan / README.md
Last active August 29, 2015 14:24
This simple little database server uses only standard libraries and runs with python 3.

Getting started

python3 database_server.py

Or, if you prefer virtual environments:

pyvenv venv
@adregan
adregan / 236.rkt
Last active October 20, 2015 19:57
#lang racket
; get-pieces : List Number String -> String
; will return a string of a given length(50) pieces shuffled repeating
; all the pieces within every x number of pieces
(define (get-pieces [pieces (list #\O #\I #\S #\Z #\L #\J #\T)] [length 50] [output ""])
(if (>= (string-length output) length)
(substring output 0 length)
(get-pieces pieces length (string-append (list->string (shuffle pieces)) output))))
def create_output_dir(directory_name='output'):
file_path = os.path.join(os.path.dirname(__file__), directory_name)
try:
os.mkdir(file_path)
except FileExistsError as err:
split_dir = directory_name.split('.v')
try:
version_number = int(split_dir[1]) + 1
except IndexError as err:
version_number = 1
var requests = require('superagent');
var fetch = function(url, options) {
let method = options.method;
return new Promise((resolve, reject) => {
requests[method](url)
.end((err, res) => {
if (err) {
reject(err);
}

Keybase proof

I hereby claim:

  • I am adregan on github.
  • I am adr (https://keybase.io/adr) on keybase.
  • I have a public key ASBvBv7JGvVygzPJOJYpQsGWLEn4X5mc1I936Ggz2zPSAAo

To claim this, I am signing this object:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<style>
.active {
fill: red;
}
</style>
var fullText = [].map.call(document.querySelector('#u_jsonp_2_11').querySelectorAll('.UFICommentBody'), (c) => c.textContent).join('. ');