Skip to content

Instantly share code, notes, and snippets.

@du-song
Created August 2, 2012 06:09
Show Gist options
  • Save du-song/3234301 to your computer and use it in GitHub Desktop.
Save du-song/3234301 to your computer and use it in GitHub Desktop.
fack - free from arguable code style
#!/usr/bin/python
import sys, re, subprocess
a = sys.argv[1].split("_")
subprocess.call("ack -i " + sys.argv[1] + "\\|" + (''.join(a) if (len(a)>1) else re.sub(r'([a-z]*)([A-Z])', r'\1_\2', a[0])), shell=True)
@broom9
Copy link

broom9 commented Aug 2, 2012

WEI-WEIs-MacBook-Pro-2:testfack weiwei$ cat ~/Dropbox/bin/fack.rb

!/usr/bin/ruby

require 'rubygems'
require 'active_support/all'
exec"ack '#{ARGV[0]}|#{ARGV[0].camelize}|#{ARGV[0].underscore}'"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment