Skip to content

Instantly share code, notes, and snippets.

View FredrikWendt's full-sized avatar

Fredrik Wendt FredrikWendt

View GitHub Profile
window.addEventListener('keydown', function(event) {
if ((event.metaKey || event.ctrlKey) && event.key === 'Enter') {
let buttons = document.getElementsByClassName("uiButton");
for (let i = 0; i < buttons.length; i++) {
let button = buttons[i];
if (button.attributes && button.attributes["data-selenium-test"]) {
if (button.attributes["data-selenium-test"].value === "UniversalSaveBar-button-primary") {
button.click();
break;
}
<html>
<head>
<title>Very nice web page</title>
</head>
<body background="white">
<h1>Welcome!</h1>
<p>This is a paragraph. It rocks!</p>
</body>
</html>
#!/usr/bin/env python
#
# Watches the dropfolder, and kicks off the dropfolder-scanner when a file is closed
#
import pyinotify, os, logging
logging.basicConfig(filename='/tmp/dropfolder.log')
logger = logging.getLogger('watcher')
logger.setLevel(logging.INFO)
@FredrikWendt
FredrikWendt / SimpleHTTPServerWithUpload.py
Created May 15, 2016 07:24 — forked from amdei/SimpleHTTPServerWithUpload.py
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
__version__ = "0.1"
__all__ = ["SimpleHTTPRequestHandler"]
@FredrikWendt
FredrikWendt / keybase.md
Created April 15, 2015 05:04
Keybase account verification

Keybase proof

I hereby claim:

  • I am FredrikWendt on github.
  • I am wendt (https://keybase.io/wendt) on keybase.
  • I have a public key whose fingerprint is 8B75 ED00 EC85 5DE4 0C6E 86EB 8215 6248 9B1E 4234

To claim this, I am signing this object:

@FredrikWendt
FredrikWendt / test.js
Created November 11, 2014 23:58
ScrumGuides Greasemonkey script
// ==UserScript==
// @name Adapt ScrumGuides
// @namespace se.wendt.scrumguides
// @include http://scrumguides.org/*
// @version 1
// @grant none
// ==/UserScript==
var a = function () {
var getURLParam = function(name) {
var search = window.location.search;
@FredrikWendt
FredrikWendt / lifo_example.js
Created October 16, 2014 09:43
Lisa Bart and Millhouse, not members of Disney
var Child = function(name) {
this.nextChild = null;
this.name = name;
}
var DisneyClub = function() {
this.toppen = null;
this.shift = function(newTop) {
newTop.nextChild = this.toppen;
@FredrikWendt
FredrikWendt / JavaForum2013019-2.java
Created September 19, 2013 16:50
I väntan på closures
// higher order "method" (class)
public abstract class UseSafely<T> {
public abstract T with(AccountConnection connection);
public T runWith(AccountConnection connection) {
synchronized (connection) {
try {
connection.open();
return with(connection);
####################################
# BASIC REQUIREMENTS
# http://graphite.wikidot.com/installation
# http://geek.michaelgrace.org/2011/09/how-to-install-graphite-on-ubuntu/
# Last tested & updated 10/13/2011
####################################
cd
sudo apt-get update
sudo apt-get upgrade
package fluent;
public class ObjectWikiExample {
public void someMethod(ObjectWikiDatabaseConnection databaseConnection) {
List<Books> books = FromDatabase(dbConn).select(Book.class).with("cover", equal("red")).with("author", like("%Wendt")).fetchAll();
for (Book book : books) {
System.out.println(book);
}
}