Skip to content

Instantly share code, notes, and snippets.

@thsig
thsig / git-open
Created March 27, 2018 15:06
Simple script for viewing a file at a given commit/branch Github.com
#!/usr/bin/env ruby
usage_description = """Usage:
github-open <commit> [<path> [<line-number>]]
Uses the <origin> remote's URL, and assumes that it's a Github repo.
"""
args = ARGV
@thsig
thsig / cube.rb
Last active April 11, 2016 19:02
brute-force count of the number of Hamiltonian paths on the surface of a cube from a given starting vertex
require 'set'
class Hash
def dig(key, *rest)
if value = (self[key] rescue nil)
if rest.empty?
value
elsif value.respond_to?(:dig)
value.dig(*rest)
end
@thsig
thsig / emacs-icelandic-keyboard.el
Last active August 29, 2015 14:02
Emacs key bindings for Icelandic keyboard
;; Icelandic keyboard setup
(define-key key-translation-map (kbd "M-ö") (kbd "\\"))
(define-key key-translation-map (kbd "M-8") (kbd "["))
(define-key key-translation-map (kbd "M-9") (kbd "]"))
(define-key key-translation-map (kbd "M-7") (kbd "{"))
(define-key key-translation-map (kbd "M-0") (kbd "}"))
(define-key key-translation-map (kbd "M-q") (kbd "@"))
(define-key key-translation-map (kbd "M--") (kbd "~"))
org.jruby.RubyMatchData.updateCharOffset(RubyMatchData.java:137)
org.jruby.RubyMatchData.begin19(RubyMatchData.java:479)
org.jruby.RubyMatchData$i$1$0$begin19.call(RubyMatchData$i$1$0$begin19.gen:65535)
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:167)
org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
org.jruby.ast.DAsgnNode.interpret(DAsgnNode.java:110)
org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
org.jruby.evaluator.ASTInterpreter.INTERPRET_BLOCK(ASTInterpreter.java:112)