Skip to content

Instantly share code, notes, and snippets.

# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")
@rlb3
rlb3 / json-reformat.el
Created March 17, 2013 19:59 — forked from gongo/json-reformat.el
json-reformat.el
;;; json-reformat --- Reformat tool for JSON
;; Author: Wataru MIYAGUNI <[email protected]>
;; Keywords: json
;; Copyright (c) 2012 Wataru MIYAGUNI
;;
;; MIT License
;;
;; Permission is hereby granted, free of charge, to any person obtaining
@rlb3
rlb3 / root.el
Created March 18, 2013 18:41
git-gutter config
(global-git-gutter-mode t)
(global-set-key (kbd "C-c C-g") 'git-gutter:toggle)
(global-set-key (kbd "C-c v =") 'git-gutter:popup-diff)
;; Jump to next/previous hunk
(global-set-key (kbd "C-c p") 'git-gutter:previous-hunk)
(global-set-key (kbd "C-c n") 'git-gutter:next-hunk)
;; Revert current hunk
@rlb3
rlb3 / root.el
Created March 18, 2013 18:43
find-file-in-git-repo config
(require 'find-file-in-git-repo)
(defadvice find-file-in-git-repo (around find-file-in-git-repo-around)
"Always look in ulc"
(let ((default-directory "/usr/local/cpanel/"))
ad-do-it))
(ad-activate 'find-file-in-git-repo)
(defalias 'find-file-in-git-repo 'ffg)
@rlb3
rlb3 / define-key.el
Last active December 15, 2015 04:28
;; C-h f edmacro-mode
;; What if you want to assign special key combination only for some specific mode? You'll generally have to know the name of ;; the key map variable for this mode:
(define-key occur-mode-map "n" 'occur-next)
@rlb3
rlb3 / emacs.txt
Last active December 15, 2015 04:58
emacs modifier chords
C-x @ S event-apply-shift-modifier
C-x @ a event-apply-alt-modifier
C-x @ c event-apply-control-modifier
C-x @ h event-apply-hyper-modifier
C-x @ m event-apply-meta-modifier
C-x @ s event-apply-super-modifier
@rlb3
rlb3 / test.rb
Last active December 15, 2015 05:49
require 'rspec'
require 'ap'
FILE = <<EOF
10.1.4.4 165.91.182.7
10.1.4.5 165.91.182.7
10.1.4.6 165.91.182.8
165.91.187.3 165.91.187.3
192.168.1.3
10.0.0.5 10.0.0.1
class CircularList < Array
def index
@index ||=0
@index.abs
end
def current
@index ||= 0
get_at(@index)
end
@rlb3
rlb3 / *scratch*.el
Created March 22, 2013 18:57
dired.el
(defun dired-back-to-top ()
(interactive)
(beginning-of-buffer)
(dired-next-line 4))
(define-key dired-mode-map
(vector 'remap 'beginning-of-buffer) 'dired-back-to-top)
(defun dired-jump-to-bottom ()
(interactive)
@rlb3
rlb3 / advice.el
Last active December 15, 2015 09:18
(defadvice executable-make-buffer-file-executable-if-script-p (around executable-make-buffer-file-executable-if-script-p-around)
"Tests should not be executable."
(unless (string= ".t" (file-name-extension (buffer-name) t))
ad-do-it))
(ad-activate 'executable-make-buffer-file-executable-if-script-p)