Skip to content

Instantly share code, notes, and snippets.

@jaydonnell
jaydonnell / gist:1299042
Created October 19, 2011 17:34
outline
* outline
** basics (very fast intro to the basics)
*** basic commands
*** buffers, minibuffer, frames, etc
*** describe-key, describe-function
** customizing keymaps
** installing libs (package.el)
** themes
font sizes
** common customizations
@jaydonnell
jaydonnell / ido-setup.el
Created October 7, 2011 17:56
package.el setup
(require 'ido)
(ido-mode t)
(setq ido-enable-prefix nil
ido-enable-flex-matching t
ido-auto-merge-work-directories-length nil
ido-create-new-buffer 'always
ido-use-filename-at-point 'guess
ido-use-virtual-buffers t
ido-handle-duplicate-virtual-buffers 2
ido-max-prospects 10)
@jaydonnell
jaydonnell / gist:1259753
Created October 3, 2011 17:51
emacs.el
;; This is the Aquamacs Preferences file.
;; Add Emacs-Lisp code here that should be executed whenever
;; you start Aquamacs Emacs. If errors occur, Aquamacs will stop
;; evaluating this file and print errors in the *Messags* buffer.
;; Use this file in place of ~/.emacs (which is loaded as well.)
(require 'ido)
(ido-mode t)
(setq ido-enable-prefix nil
ido-enable-flex-matching t
[error] found : blueeyes.core.service.package.HttpRequestHandler2[String,blueeyes.json.JsonAST.JArray]
[error] required: blueeyes.core.service.package.HttpRequestHandler[java.lang.Comparable[_ >: blueeyes.json.JsonAST.JValue with java.lang.String <: java.lang.Comparable[_ >: blueeyes.json.JsonAST.JValue with java.lang.String <: java.lang.Comparable[_ >: blueeyes.json.JsonAST.JValue with java.lang.String <: java.lang.Comparable[_ >: blueeyes.json.JsonAST.JValue with java.lang.String <: java.lang.Object]]]] with java.io.Serializable]
@jaydonnell
jaydonnell / gist:1248713
Created September 28, 2011 18:08
anything-git.el
(add-to-list 'load-path "/Users/jaydonnell/Library/Preferences/Aquamacs Emacs/aquamacs-emacs-starter-kit/vendor/anything-config")
(require 'anything)
(require 'anything-match-plugin)
(require 'anything-config)
(setq recentf-max-saved-items 500)
;; http://www.emacswiki.org/emacs/AnythingSources#toc65
(defun anything-c-sources-git-project-for (pwd)
@jaydonnell
jaydonnell / slow_pages.rb
Created September 16, 2011 16:53
find slow pages in your rails app
# usage: cat log/production.log | grep Completed | ruby slow_pages.rb
ARGF.each_line do |line|
fields = line.split(' ')
total = fields[4].to_f / 1000.0
ar = fields[9].to_f / 1000.0
if total > 1
puts "total: #{total} AR: #{ar}"
end
end
string[] cities = { "Boston", "Los Angeles",
"Seattle", "London", "Hyderabad" };
IEnumerable<string> filteredCities =
from city in cities
where city.StartsWith("L") && city.Length < 15
orderby city
select city;
def self.link_hashtags(s)
s.gsub(/( |^)#[a-zA-Z0-9][^#\s-]*/) { |match| '<a href="/search?q=' + CGI.escape(match) + '">' + match + '</a>'}
end
#bob #jay
should become
<a href="/search?q=#bob">#bob</a> <a href="/search?q=#jay">#jay</a>
[[ -s "$HOME/.rvm/contrib/ps1_functions" ]] && source "$HOME/.rvm/contrib/ps1_functions"
ps1_set --prompt ∴
class UsersController < ApplicationController::Base
respond_to :html, :xml, :json
def show
respond_with(@user = User.find(params[:id]))
end
def index
respond_with(@users = User.all)
end