Skip to content

Instantly share code, notes, and snippets.

@rlb3
rlb3 / emacs-pipe.pl
Created August 12, 2011 23:18 — forked from aufflick/emacs-pipe.pl
Piping to an emacs buffer with emacsclient
#!/usr/bin/env perl
# You can use this script in a pipe. It's input will become an emacs buffer
# via emacsclient (so you need server-start etc.)
# See http://mark.aufflick.com/o/886457 for more information
# Copyright (C) 2011 by Mark Aufflick <mark@aufflick.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
@rlb3
rlb3 / PerlFeedTest.m
Created November 11, 2011 14:20
Test using PubSub framwork
//
// main.m
// PerlFeedTest
//
// Created by Robert Boone on 6/3/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <PubSub/PubSub.h>
@rlb3
rlb3 / NSString+Json.m
Created November 30, 2011 04:06
NSString JSON Category
#import <Foundation/Foundation.h>
@interface NSString (NSString_NSJSONSerialization)
-(id)toArray;
-(id)toDict;
@end
@implementation NSString (NSString_NSJSONSerialization)
-(id)toArray {
NSData *jsonData = [self dataUsingEncoding:NSUTF8StringEncoding];
@rlb3
rlb3 / opml2org.pl
Created January 5, 2012 15:00 — forked from alandipert/opml2org.pl
Convert OPML to org-mode style nested headings, suitable for Confluence or Emacs
#!/usr/bin/perl
# Usage: perl opml2org.pl "My OPML File.opml"
use XML::Parser;
binmode STDOUT, ":utf8";
$xp = new XML::Parser();
$xp->setHandlers(Start => \&start, End => \&end);
$xp->parsefile($ARGV[0]);
$indent = 0;
@rlb3
rlb3 / gitconfig
Created January 16, 2012 15:25
ediff as a git merge tool
[mergetool.ediff]
cmd = /opt/emacs24/bin/emacs -q --eval \"(progn (defun ediff-write-merge-buffer () (let ((file ediff-merge-store-file)) (set-buffer ediff-buffer-C) (writ\
e-region (point-min) (point-max) file) (message \\\"Merge buffer saved in: %s\\\" file) (set-buffer-modified-p nil) (sit-for 1))) (setq ediff-quit-hook 'kill\
-emacs ediff-quit-merge-hook 'ediff-write-merge-buffer) (ediff-merge-files-with-ancestor \\\"$LOCAL\\\" \\\"$REMOTE\\\" \\\"$BASE\\\" nil \\\"$MERGED\\\"))\"
@rlb3
rlb3 / url-auth.el
Created February 4, 2012 22:30
url auth
(let* ((my-auth '(("localhost:80" ("iOS Pratice" . "cm9iZXJ0OmtvbWJhdA=="))))
(url-basic-auth-storage 'my-auth))
(switch-to-buffer (url-retrieve-synchronously "http://localhost/~robert/pratice")))
(defmacro web-auth (&rest body)
`(let* ((my-auth '(("localhost:80" ("iOS Pratice" . "cm9iZXJ0OmtvbWJhdA=="))))
(url-basic-auth-storage 'my-auth))
,@body))
(macroexpand-all '(web-auth
@rlb3
rlb3 / org-agendas.txt
Created February 17, 2012 18:43
Org-mode Agendas
Before we talk about Agendas in org-mode I need to add two more
things that I forgot to add last time. The first are a few basic
global key bindings you should have for org-mode in your .emacs
file.
1: (global-set-key "\C-cl" 'org-store-link)
2: (global-set-key "\C-ca" 'org-agenda)
3: (global-set-key "\C-cb" 'org-iswitchb)
@rlb3
rlb3 / ns-cheatsheet.clj
Created March 9, 2012 13:37 — forked from ghoseb/ns-cheatsheet.clj
Clojure ns syntax cheat-sheet
;;
;; NS CHEATSHEET
;;
;; * :require makes functions available with a namespace prefix.
;;
;; * :use makes functions available without a namespace prefix
;; (i.e., refers functions to the current namespace).
;;
;; * :import refers Java classes to the current namespace.
;;
@rlb3
rlb3 / fizzbuzz.clj
Created April 12, 2012 18:30
fizzbuzz
(ns fizzbuzz)
(defn fizz [n]
(if (zero? (mod n 3)) "fizz"))
(defn buzz [n]
(if (zero? (mod n 5)) "buzz"))
(def fb-list [fizz buzz])
@rlb3
rlb3 / sandbox.el
Created April 19, 2012 14:00
emacs make sandbox intergration
(defmacro with-directory (dir &rest body)
(declare (indent 2))
(let ((hold-dir (gensym)))
`(let ((,hold-dir default-directory))
(unwind-protect
(progn
(cd ,dir)
,@body)
(cd ,hold-dir)))))