Skip to content

Instantly share code, notes, and snippets.

View akuhn's full-sized avatar

Adrian Kuhn akuhn

  • Command-line
View GitHub Profile
@akuhn
akuhn / Promise.java
Created November 23, 2012 19:02
Avoid callback hell in Eclipse.
package com.example;
import static org.junit.Assert.assertEquals;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.concurrent.CountDownLatch;
import org.junit.Test;
public class Promise {
@akuhn
akuhn / icse2013-preprint.md
Created November 29, 2012 23:19
Preprints of ICSE 2013 papers

Preprints of ICSE 2013 papers

Found 21 preprints so far of the 85 papers listed here, http://2013.icse-conferences.org/content/accepted-papers-technical-research-track (most recent additions first)

If yours is missing, tweet or email me! The same if you find a false positive.

What Good Are Strong Specifications? Nadia Polikarpova, Carlo A. Furia, Yu Pei, Yi Wei, and Bertrand Meyer (ETH Zurich, Switzerland)

var http = require('http');
var shared = {count: 0}
var server = http.createServer(function (req, res) {
console.log([req.method,req.url])
res.writeHead(200, {'Content-Type': 'text/plain'})
res.write('You called me ' + (shared.count += 1) + ' times!\n')
res.write('You are looking at ' + req.url + '\n')
@akuhn
akuhn / reverse.user.js
Last active December 23, 2015 14:59
Reverse web for Niko’s inverse party.
// ==UserScript==
// @name Reverse Web
// @namespace http://www.example.com
// @grant
// ==/UserScript==
function reverseWordButKeepCase(str) {
var buffer = ""
for (var i = 0, j = str.length - 1; i < str.length; i++, j--) {
if (str.charAt(i) == str.charAt(i).toUpperCase()) {
@akuhn
akuhn / twitter-photo-preview-fixed.user.js
Last active December 27, 2015 03:09
Don’t like Twitter's new photo preview? Same here. Fixed.
// ==UserScript==
// @name Disable Photo Preview on Twitter
// @namespace http://example.com
// @description hacked with love by @akuhn
// @include https://twitter.com/*
// @version 1
// @grant none
// ==/UserScript==
function addGlobalStyle(css) {
@akuhn
akuhn / layout.html
Created December 13, 2013 09:40
Nested layouts for d3.
<html>
<head>
<script src="d3.v3.min.js" charset="utf-8"></script>
<style>
rect {
stroke: blue;
fill: #eee;
}
</style>
</head>
@akuhn
akuhn / twitter-dark-navbar.user.js
Last active January 3, 2016 06:29
Missing Twitter's dark navigation bar? Same here. Fixed.
// ==UserScript==
// @name Twitter Dark Navbar
// @namespace http://example.com
// @description hacked with love by @akuhn
// @include https://twitter.com/*
// @version 1
// @grant none
// ==/UserScript==
function addGlobalStyle(css) {
@akuhn
akuhn / tmLanguage.rb
Last active August 29, 2015 14:00
This script extracts the structure of language grammars used for syntax highlighting in Sublime. You need to convert the grammar to a JSON file before running this script.
require 'rubygems'
require 'json'
# This script extracts the structure of Sublime language grammars ...
#
# Usage: ruby tmLanguage.rb PHP.JSON-tmLanguage
$root = JSON.parse(File.read(ARGV.first))
$seen = []
$stack = []
// ==UserScript==
// @name Peace of Mind
// @namespace http://example.com
// @description Facebooking without newsfeed.
// @include https://*.facebook.com/*
// @grant none
// ==/UserScript==
(function() {
#!/usr/bin/env bash
if [[ $1 == '' ]]
then
ruby -e 'branches = `git branch`.split($/)' \
-e 'merged = `git branch --merged master`.split($/)' \
-e '(branches & merged).each { |d| d[2...2] = "\e[32m" }' \
-e 'print branches.join("\e[m\n").gsub("* ", "* \e[33m")' \
-e 'puts "\e[m"'
elif [[ $1 == '-' ]]
then