- Smarter completion. A few examples:
- context sensitive -- if you have file "name1" and directory "name2", "cd nam<TAB>" completes to "name2/"
- "tar xf <TAB>" completes to tarballs only. "unrar x <TAB>" completes to RARs only. etc.
- rsync / scp completion: "rsync host:anything/<TAB>" shows you files on host under anything/
- also works with rsync:// URLs
- SSH host completion from ~/.ssh/config & ~/.ssh/known_hosts
- lots of other smart completions: Rake tasks, git commands & SHAs, dpkg packages, dash-options for most commands, etc etc.
declare @tablename varchar(255) | |
declare @logfilename nvarchar(200) | |
declare @datafilename nvarchar(200) | |
declare @dbname nvarchar(200) | |
declare @sql nvarchar(1000) | |
set @dbname = ltrim(rtrim(db_name())) | |
set @logfilename = ltrim(rtrim((select name from sysfiles where lower(filename) like '%.ldf%'))) | |
set @datafilename = ltrim(rtrim((select name from sysfiles where lower(filename) like '%.mdf%'))) |
list untracked, unignored files: git ls-files -o --exclude-standard | |
unstage: git reset HEAD FILE | |
unstage and undo local: git reset --hard HEAD FILE | |
undo unstaged file: git checkout -- FILE | |
undo commit with using new commit: git revert [HEAD|$id] | |
update last commit to include missed adds: git commit --amend (after git add FILE) | |
git push origin :branch #remove remote | |
git remote prune origin |
Moved to README within Vim Environment repo | |
http://github.com/actaneon/VimEnv/blob/master/README |
require "money" | |
class Decorator < BasicObject | |
undef_method :== | |
def initialize(component) | |
@component = component | |
end | |
def method_missing(name, *args, &block) |
Drink recipes are subjective. Experimentation is a lot of fun, and quite frankly encouraged. However, you really should know what the fuck you're doing before you go all willy nilly throwing everything in your kitchen into a glass and calling it a cocktail. This is the classic Mojito. It's damn fine on it's own. In fact, this is the only way I drink them. Once you've mastered this technique, feel free to experiment with other stuff like mangoes or pineapple or whatever. Just, please, don't call your franken-drink a Mojito.
Dear Rubyists,
I just lost a contract because of my code in a Rails project.
The specific code in question is related to a "posting a comment" feature. Here are the details:
In this project, "posting a comment" does not simply entail inserting a row into the database. It involves a procedure to yes, insert a row, but also detect its language, check for spam, send emails, and "share" it to Twitter and Facebook. I believe this algorithm should be encapsulated. I do not believe it belongs in a controller or a model. I do not believe Active Record callbacks should be used.
The "senior developer", whom is the stake holder's right hand man, said this:
require 'resque/errors' | |
class DatabaseBackupJob | |
def self.perform(id, foo, bar) | |
# do backup work | |
rescue Resque::TermException | |
# write failure to database | |
# re-enqueue the job so the job won't be lost when scaling down. | |
Resque.enqueue(DatabaseBackupJob, id, foo, bar) |
This is how I debug SystemStackError when there is no stack trace.
My first attempt was:
begin
a_method_that_causes_infinite_recursion_in_a_not_obvious_way
rescue SystemStackError
puts caller
end