Skip to content

Instantly share code, notes, and snippets.

View akuhn's full-sized avatar

Adrian Kuhn akuhn

  • Command-line
View GitHub Profile
// ==UserScript==
// @name Readable emails
// @namespace http://example.com
// @author [email protected]
// @match https://mail.google.com/*
// @version 1.0
// @grant GM_addStyle
// ==/UserScript==
GM_addStyle('.ii { font: 160% Serif !important; }');
@akuhn
akuhn / .pryrc
Last active December 23, 2016 00:30
if defined? PryDebugger
Pry.commands.alias_command 'c', 'continue'
Pry.commands.alias_command 'f', 'finish'
Pry.commands.alias_command 'n', 'next'
Pry.commands.alias_command 's', 'step'
end
def __objects__(filter)
GC.disable
enum = ObjectSpace.each_object(filter)
# Maps a Rails route to a dynamic action name using interpolation.
#
# get 'experiments/ajax/:endpoint', to: dynamic('experiments#ajax_%{endpoint}')
class Dynamic
def initialize(to)
@to = to
end
def call(env)
params = env['action_dispatch.request.path_parameters']
// ==UserScript==
// @name Github Large Emoji
// @namespace example
// @include https://github.com/*
// @version 1.0
// @grant GM_addStyle
// ==/UserScript==
GM_addStyle('img.emoji { width: 64px; height: 64px }');
require 'active_record'
require 'colorize'
require 'pry'
class Eigenlogger
def debug?
true
end
def debug(message)
message.uncolorize =~ /^ (.*?) (.*)$/
[alias]
d = "!cd ${GIT_PREFIX:-.} && git diff && [[ -z \"$(git diff)\" ]] && git diff --staged && [[ -z \"$(git diff --staged)\" ]] && git log -p master.."
l = "!cd ${GIT_PREFIX:-.} && if [[ -z \"$(git diff --name-only && git diff --name-only --staged)\" ]]; then git log --stat master..; else git status; fi"
book = bookmark
drop = stash save 'dropping local changes'
touch = "!GIT_COMMITTER_DATE=\"`date`\" git commit --amend --date \"`date`\""
wip = stash save 'work in progress'
[color]
ui = auto
[core]
// ==UserScript==
// @name Github Praise
// @namespace example
// @include https://git.musta.ch/*
// @include https://github.com/*
// @version 1.2
// @grant GM_addStyle
// ==/UserScript==
GM_addStyle('.line-age { padding: 0px 12px !important; }');
#!/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
// ==UserScript==
// @name Peace of Mind
// @namespace http://example.com
// @description Facebooking without newsfeed.
// @include https://*.facebook.com/*
// @grant none
// ==/UserScript==
(function() {
@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 = []