Skip to content

Instantly share code, notes, and snippets.

View legumbre's full-sized avatar

Leonardo Etcheverry legumbre

  • GlamST / Ulta
  • Montevideo, Uruguay
View GitHub Profile
@legumbre
legumbre / gud-toggle-bkpt.el
Created August 12, 2015 18:15
Toggle breakpoint command from a gud source buffer
(defun my-gud-toggle-breakpoint ()
"Enable/disable breakpoint at the current line of source buffer."
(interactive)
(save-excursion
(beginning-of-line)
(let* ((bol (point))
(ovl (overlay-get (car (overlays-in bol bol)) 'before-string))
(bptno (get-text-property 0 'gdb-bptno ovl))
(bpten (get-text-property 0 'gdb-enabled ovl)))
(if bpten (gud-basic-call (format "-break-disable %s" bptno))
@legumbre
legumbre / love2d.el
Created November 18, 2014 21:01
launch love2d app from Emacs
(defvar love2d-program "~/dev/love.app/Contents/MacOS/love")
(defun love2d-launch-current ()
(interactive)
(let ((app-root (locate-dominating-file (buffer-file-name) "main.lua")))
(if app-root
(shell-command (format "%s %s &" love2d-program app-root))
(error "main.lua not found"))))
@legumbre
legumbre / ptype_tostring.lua
Created October 4, 2014 05:12
prototype lua tostring
prototype = require 'prototype'
person = prototype { default = prototype.assignment_copy, use_prototype_delegation = true }
person.__tostring = function (s) return "My name is " .. s.name end
cacho = person:clone()
cacho.name = "Cacho"
print(cacho)
pocha = person:clone()
(add-to-list
'compilation-error-regexp-alist-alist
'(mvn-error-windows "\\[ERROR\\][[:blank:]]+\\(.*\\):\\[\\([0-9]+\\),\\([0-9]+\\)\\]" (lambda () (replace-regexp-in-string "\\\\" "/" (match-string 1))) 2 3 1 1 (0 compilation-error-face)))
(add-to-list 'compilation-error-regexp-alist 'mvn-error-windows)
@legumbre
legumbre / gist:9a09b86d56a541ca57d7
Created May 26, 2014 21:24
calc and HMS values
;; 1. use a keyboard macro or regexp to turn your lines into:
0@ 58' 40.575"
0@ 30' 20.0"
2@ 58' 40.575"
;; 2. with region including all the previous lines, use calc-grab to grab all those values into calc:
M-x calc-grab-region or C-x * g
;; 3. Your calc buffer will look like:
@legumbre
legumbre / findcommitforblob.sh
Created May 3, 2014 05:12
find commit containing blob with hash
#!/bin/sh
obj_name="$1"
shift
git log "$@" --pretty=format:'%T %h %s' \
| while read tree commit subject ; do
if git ls-tree -r $tree | grep -q "$obj_name" ; then
echo $commit "$subject"
fi
done
@legumbre
legumbre / magit-pull-advice.el
Created April 30, 2014 14:36
verbose magit-pull
(defadvice magit-pull (around magit-pull-verbose compile activate)
"Force magit to use -v for git pull"
(let ((magit-custom-options (cons "-v" magit-custom-options)))
ad-do-it))
@legumbre
legumbre / gist:9364665
Created March 5, 2014 10:16
afconvert: converting caff to wav
afconvert -f WAVE -d LEI16@44100 map_loop.m4a -o map_loop.wav
@legumbre
legumbre / all-magit-logs.el
Created March 1, 2014 08:11
magit verbose logging hack
;; magit verbose logging hack
(defadvice magit-cmd-output (around magit-log-git-output activate)
(let ((output-string ad-do-it))
(with-current-buffer (get-buffer-create "*magit-debug-output*")
(insert output-string))
output-string))
;;; erc-highlight-nicknames.el --- Highlights nicknames
;; Copyright (C) 2007 André Riemann
;; Copyright (C) 2008 Andy Stewart
;; Author: André Riemann <andre.riemann@web.de>
;; Maintainer: André Riemann <andre.riemann@web.de>
;; Created: 2007-09-25
;; Keywords: comm, faces