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
#!/usr/bin/env ruby | |
# | |
# I use the following script to trick myself into writing every day. | |
# | |
# All it does is create a directory for the current month (YYYY/MM), | |
# create an empty markdown file for today and annoy the hell out of | |
# me until I put something in that file. | |
# | |
# I run the script with GeekTool every 30 minutes: | |
# http://projects.tynsoe.org/en/geektool/ |
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
# rspec | |
group :test do | |
gem 'rspec-rails' | |
gem 'launchy' | |
gem 'capybara' | |
gem 'webrat' | |
gem 'database_cleaner' | |
gem 'email_spec' | |
gem 'factory_girl_rails' | |
end |
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
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH" | |
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session. | |
alias cdd='cd ~/Development' | |
alias gst='git status' | |
alias gl='git pull' | |
alias gp='git push' | |
alias gd='git diff | mate' |
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
# source: http://www.enriquedelgado.com/articles/2007/04/25/interactive-ruby-console-tip-remember-the-last-x-commands-even-after-logging-out | |
# file: .irbrc | |
IRB.conf[:PROMPT_MODE] = :SIMPLE | |
require 'irb/completion' | |
IRB.conf[:AUTO_INDENT] = true | |
# Session History |
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
cat ~/.ssh/id_rsa.pub | ssh user@example.com 'cat >>.ssh/authorized_keys' |
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 | |
BACKUP_DIR='/home/rsync/mysql_backup' | |
MHOST='localhost' | |
MUSER='root' | |
MPASS='yourpass' | |
NOW=$(date +"%Y-%m-%d_%H") |
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 String | |
def to_slug | |
s = self.gsub(/&/, 'and') # replace ampersand chars with 'and' before stripping HTML | |
s.gsub!(/<.*?>/, '') # strip HTML | |
s.gsub!(/&/, 'and') # replace ampersand chars with 'and' | |
s = Iconv.iconv('ascii//ignore//translit', 'utf-8', s).to_s # Borrowed partially from Technoweenie's PermalinkFu | |
s.gsub!(/\W+/, ' ') # all non-word chars to spaces | |
s.strip! | |
s.downcase! | |
s.gsub!(/[\W^-_]+/, '-') # replace non-word chars with dashes |
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 Devise | |
module Controllers | |
module ScopedViews | |
protected | |
# Monkey path for generating proper templates path when dealing with | |
# namespaced resources and custom views. | |
def render_with_scope(action, options={}) | |
controller_name = options.delete(:controller) || self.controller_name | |
if self.class.scoped_views? |
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
# 1 | |
Foo.bar( | |
:one => 1, | |
:two => 2 | |
) | |
# 2 | |
Foo.bar( | |
:one => 1, | |
:two => 2) |
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 'net/http' | |
out = `arp-scan -lq` | |
macs = | |
out.split("\n").map do |line| | |
if line =~ /([0-9A-F][0-9A-F :]{16})/i | |
puts $1 | |
$1.split(' ').join(':').upcase | |
end | |
end.compact.join(',') |
OlderNewer