Skip to content

Instantly share code, notes, and snippets.

(defun rrnic-diff (cmd1 cmd2)
(interactive
(list
(read-shell-command "Shell command (1): " nil nil)
(read-shell-command "Shell command (2): " nil nil)))
(let ((b1 (get-buffer-create "*1*")) (b2 (get-buffer-create "*2*")))
(shell-command cmd1 b1)
(shell-command cmd2 b2)
(ediff-buffers b1 b2)))
@legumbre
legumbre / foo.md
Created June 29, 2012 00:14
resolving merge conflicts with magit-ediff

Use magit-ediff to resolve merge conflicts

Use magit-ediff or 'e' on an unmerged item to resolve merge conflicts with ediff. Magit will set up an ediff with three buffers A, B and C. A and B are the original (conflicting) files, and C is the conflicted merge.

Use 'n'/'p' to move to the next/previous conflict, use 'a'/'b' to choose which changes (those in a A or B) should be the ones to keep in the merged file.

You can always just switch to buffer C and edit what the merged version should look like.

@cjohansen
cjohansen / hgrep.rb
Last active December 10, 2015 22:09
hgrep - historic grep. Find the last version where some string occurred in a file in a git repository.
#!/usr/bin/env ruby
if ARGV.length < 2
puts "#{File.basename(__FILE__)} file pattern [grep options]"
exit 1
end
`git reflog #{ARGV[0]}`.split("\n").each do |ref|
oid = ref.split(" ").first
if `git cat-file -p #{oid}:#{ARGV[0]} | grep #{ARGV[1]}` != ""
@glucas
glucas / gist:4506530
Created January 10, 2013 22:56
Jumping to the most recent buffer.
(defalias 'last-buffer 'mode-line-other-buffer)
(global-set-key (kbd "M-O") 'last-buffer)
(defun my/split-window()
"Split the window to see the most recent buffer in the other window.
Call a second time to restore the original window configuration."
(interactive)
(if (eq last-command 'my/split-window)
(progn

Semantic Key-bindings

The following is an issue that comes up from time to time on #emacs, and we don’t really have a good answer to it. I don’t for a minute think that I have figured this whole thing out, but here goes.

The problem

Joe Hacker is an Emacs user, and is quite content, only some he doesn’t like a particular key-binding. To make things concrete, he

@progrium
progrium / gist:5734609
Last active October 14, 2019 07:15
Let unprivileged processes easily restart/reload Nginx without sudo or setuid hacks
# run this as root
while [ 1 ]; do echo | nc -l -U /tmp/reload_nginx && /etc/init.d/nginx reload; done
# or as an upstart job
script
echo | nc -l -U /tmp/reload_nginx && /etc/init.d/nginx reload
end script
respawn
# now any process can run this or do the equivalent with sockets to trigger reload
@bhauman
bhauman / README.md
Last active December 3, 2019 16:43
ClojureScript minimal dev and prod setup.

Recent improvements to the ClojureScript compiler have greatly simplified setting up development versus production outputs.

This example uses Figwheel as something that you want to exclude for production, but the pattern is general.

With this simple setup you only need one html file/view and it will work for developement and production.

@reborg
reborg / rich-already-answered-that.md
Last active February 23, 2024 13:09
A curated collection of answers that Rich gave throughout the history of Clojure

Rich Already Answered That!

A list of commonly asked questions, design decisions, reasons why Clojure is the way it is as they were answered directly by Rich (even when from many years ago, those answers are pretty much valid today!). Feel free to point friends and colleagues here next time they ask (again). Answers are pasted verbatim (I've made small adjustments for readibility, but never changed a sentence) from mailing lists, articles, chats.

How to use:

  • The link in the table of content jumps at the copy of the answer on this page.
  • The link on the answer itself points back at the original post.

Table of Content