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
# Awesome truncate | |
# From: http://daniel.collectiveidea.com/blog/2007/7/10/a-prettier-truncate-helper | |
# | |
# First regex truncates to the length, plus the rest of that word, if any. | |
# Second regex removes any trailing whitespace or punctuation (except ;). | |
# Unlike the regular truncate method, this avoids the problem with cutting | |
# in the middle of an entity ex.: truncate("this & that",9) => "this &am..." | |
# though it will not be the exact length. | |
def awesome_truncate(text, length = 30, truncate_string = "...") | |
return if text.nil? |
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/sh | |
# | |
# Modified ruby.Slackbuild for Ruby 1.8.6-p287 | |
# Ruby 1.8.7-p72 give me problems with rails 2.2 | |
# | |
# Copyright 2008 Patrick J. Volkerding, Sebeka, MN, USA | |
# All rights reserved. | |
# | |
# Redistribution and use of this script, with or without modification, is | |
# permitted provided that the following conditions are met: |
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
# Top cpu used by process | |
ps -eo pcpu,pid,user,args | sort -k 1 -r | head -n10 |
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
FuzzyFinder has a bug when works TagList plugin (it open the file in taglist, very annoying). It’s solved in fuzzyfinder 2.16 changing the line 1483: | |
wincmd p | |
to: | |
wincmd j | |
Then the next time that you open a file it’ll open in correct window. | |
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
# Diff two files(vertically) without use vimdiff from shell | |
vert diffsplit |
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
# Testing routes from console | |
>> app.users_path | |
=> "/users" |
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
# Display top cpu use | |
ps aux|sort -nr +2|head -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
# Show relations in a model | |
Model.reflect_on_all_associations.map(&:class_name) |
NewerOlder