This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rubygems" | |
require 'compass' #must be loaded before sinatra | |
require 'sinatra' | |
require 'builder' | |
require 'haml' | |
require 'sass' | |
require File.join(File.dirname(__FILE__), *%w[lib cache]) | |
require File.join(File.dirname(__FILE__), *%w[lib config]) | |
require File.join(File.dirname(__FILE__), *%w[lib models]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;default display position/size based on display resolution | |
;;warning: assumption that the 24/22 " displays are oriented | |
;; above the laptop's display | |
;; Haven't found a way to check multiple monitor | |
;; relative orientation via emacs yet... | |
;; NOTE: try integrating with applescript for this? | |
(defun reset-ui () | |
(interactive) | |
(delete-other-windows) | |
(color-theme-merbivore) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# before align-regexp, not super easy to read | |
var = 5 | |
another_value = 10 | |
assignment = 5 | |
very_long_var_name = 25 | |
# after align-regexp =, readability improved! | |
var = 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun delete-file-and-buffer () | |
"Deletes the current file and buffer, assumes file exists" | |
(interactive) | |
(delete-file buffer-file-name) | |
(kill-buffer (buffer-name))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; make zap-to-char act like zap-up-to-char | |
(defadvice zap-to-char (after my-zap-to-char-advice (arg char) activate) | |
"Kill up to the ARG'th occurence of CHAR, and leave CHAR. | |
The CHAR is replaced and the point is put before CHAR." | |
(insert char) | |
(forward-char -1)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require 'color-theme) | |
;;;###autoload | |
(defun color-theme-merbivore () | |
(interactive) | |
(color-theme-install | |
'(color-theme-merbivore | |
((background-color . "black") | |
(background-mode . dark) | |
(cursor-color . "deeppink") | |
(foreground-color . "#E6E1DC")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;resurrect *scratch* buffer | |
;; FROM: Morten Welind | |
;;http://www.geocrawler.com/archives/3/338/1994/6/0/1877802/ | |
(save-excursion | |
(set-buffer (get-buffer-create "*scratch*")) | |
(lisp-interaction-mode) | |
(make-local-variable 'kill-buffer-query-functions) | |
(add-hook 'kill-buffer-query-functions 'kill-scratch-buffer)) | |
(defun kill-scratch-buffer () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
### ABOUT: See: http://gist.github.com/366269 | |
### Runs rsync, retrying on errors up to a maximum number of tries. | |
### On failure script waits for internect connection to come back up by pinging google.com before continuing. | |
### | |
### Usage: $ ./rsync-retry.sh source destination | |
### Example: $ ./rsync-retry.sh [email protected]:~/* ~/destination/path/ | |
### | |
### INPORTANT: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# say we start with an empty bash command history | |
bash-3.2$ history | |
1 history | |
# enter a command that requires a password | |
bash-3.2$ sudo rm -i some_file | |
Password: | |
# accidentally ^C and type your password | |
# into the prompt and hit enter |