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
"192.168.1.1:8000".named_matches(/(?<ip>\d.+):(?<port>\d+)/) | |
#=> [{"ip"=>"192.168.1.1", "port"=>"8000"}] |
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
;; emacs configuration | |
(push "/usr/local/bin" exec-path) | |
(add-to-list 'load-path "~/.emacs.d") | |
(setq make-backup-files nil) | |
(setq auto-save-default nil) | |
(setq-default tab-width 2) | |
(setq-default indent-tabs-mode nil) | |
(setq inhibit-startup-message t) |
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
# ZSH config | |
# Encoding | |
LANG=en_US.UTF-8 | |
# Path | |
export PATH=$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/usr/games:. | |
# Appearence | |
# ls colors |
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
class Object | |
cattr_accessor :current_test | |
end | |
module Minispec | |
class TestClass | |
def self.prepare(desc) | |
name = name_for_class(desc) | |
Class.new(base_test_class(name)) do | |
define_singleton_method(:name) { 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
(function ($) { | |
// Monkey patch jQuery 1.3.1+ css() method to support CSS 'transform' | |
// property uniformly across Webkit/Safari/Chrome and Firefox 3.5. | |
// 2009 Zachary Johnson www.zachstronaut.com | |
function getTransformProperty(element) | |
{ | |
// Try transform first for forward compatibility | |
var properties = ['transform', 'WebkitTransform', 'MozTransform']; | |
var p; | |
while (p = properties.shift()) |
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
;; custom for ubuntu | |
(setq gem_home "/home/mig/.gem") | |
(setenv "GEM_HOME" gem_home) | |
;; Swap alt and meta in emacs | |
; (setq x-super-keysym 'meta) | |
(setq x-select-enable-clipboard t) | |
(setq interprogram-paste-function 'x-cut-buffer-or-selection-value) |
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
;; emacs-key-bindings.el - bindings that make life easier | |
(global-set-key (kbd "C-c b") 'eval-buffer) | |
(global-set-key (kbd "C-x f") 'recentf-ido-find-file) | |
(global-set-key (kbd "M-s") 'save-buffer) | |
(global-set-key (kbd "M-z") 'undo) | |
;; set line commenting to textmate style | |
(global-set-key (kbd "M-/") 'comment-or-uncomment-region) | |
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
;; Experimental theme by Geoffrey Grosenbach | |
;; | |
;; SCREENSHOT: http://blog.peepcode.com/tutorials/2009/ruby-emacs-flog | |
;; | |
;; USAGE: | |
;; Copy to your emacs config directory, load it, and activate. | |
;; | |
;; ;; Requires the color-theme package: | |
;; (add-to-list 'load-path (concat dotfiles-dir "/vendor/color-theme")) | |
;; (require 'color-theme) |
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
module ActiveRecord | |
class Errors | |
# Redefine the ActiveRecord::Errors::full_messages method: | |
# Returns all the full error messages in an array. 'Base' messages are handled as usual. | |
# Non-base messages are prefixed with the attribute name as usual UNLESS they begin with '^' | |
# in which case the attribute name is omitted. | |
# E.g. validates_acceptance_of :accepted_terms, :message => '^Please accept the terms of service' | |
def full_messages | |
full_messages = [] |
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
task :deploy do | |
`rsync -rltvz -e ssh . deploy@hostname:/var/www/apps/my_app` | |
`ssh deploy@hostname touch /var/www/apps/my_app/public/restart.txt` | |
end |