Skip to content

Instantly share code, notes, and snippets.

View kana's full-sized avatar

Kana Natsuno kana

View GitHub Profile
@nelstrom
nelstrom / vim-keystrokes.rb
Created December 5, 2012 16:14
A proof-of-concept parser for making Vim keystrokes more readable.
require 'parslet'
class Mini < Parslet::Parser
rule(:start) { match('[iIaAoOsS]').as(:switch) }
rule(:typing) { match('[^\e]').repeat.as(:typing) }
rule(:terminate) { match('\e').as(:escape) }
rule(:insertion) { start >> typing >> terminate }
root(:insertion)
end
@kana
kana / bookmarklet.txt
Created June 14, 2012 09:18
A bookmarklet to investigate an XPath expression of a clicked element.
javascript:(function(){var dialog=document.createElement("div");var setUpDialog=function(){dialog.style.position="fixed";dialog.style.bottom="0";dialog.style.left="10%";dialog.style.width="80%";dialog.style.color="#333";dialog.style.background="#efe";dialog.style.border="thin solid #9a9";dialog.style.margin="0 0 0.5em";dialog.style.padding="0.5em 1em";dialog.style.fontFamily="monospace";document.getElementsByTagName("body")[0].appendChild(dialog)};var notify=function(message){dialog.textContent=message};var loadJavaScript=function(uri){var script=document.createElement("script");script.setAttribute("type","text/javascript");script.setAttribute("src",uri);document.getElementsByTagName("body")[0].appendChild(script)};var isJQueryLoaded=function(){return window.jQuery!==undefined};var waitLoadingJQuery=function(continuation){var tryCount=0;var step=function(){if(isJQueryLoaded())continuation();else{tryCount++;setTimeout(step,tryCount*100);notify("Loading"+(new Array(tryCount+1)).join("."))}};step()};var getXPath
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#