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
(?xi) | |
\b | |
( # Capture 1: entire matched URL | |
(?: | |
[a-z][\w-]+: # URL protocol and colon | |
(?: | |
/{1,3} # 1-3 slashes | |
| # or | |
[a-z0-9%] # Single letter or digit or '%' | |
# (Trying not to match e.g. "URI::Escape") |
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 'digest/md5' | |
def gfm(text) | |
# Extract pre blocks | |
extractions = {} | |
text.gsub!(%r{<pre>.*?</pre>}m) do |match| | |
md5 = Digest::MD5.hexdigest(match) | |
extractions[md5] = match | |
"{gfm-extraction-#{md5}}" | |
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
#!/usr/bin/ruby | |
require 'rubygems' | |
require 'git' | |
log = "~/gitlog.txt" | |
tmp = "/tmp/gitlog" | |
commit = Git.open('.').log.first | |
message = [ | |
commit.date.strftime('%D %H:%M'), |
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
# by bryan helmkamp with slight modification by chris wanstrath | |
# from http://www.brynary.com/2008/8/3/our-git-deployment-workflow | |
# I DO NOT RECOMMEND USING THIS WORKFLOW - IT DESTROYS HISTORY! - jesse andrews | |
module GitCommands | |
extend self | |
def diff_staging | |
`git fetch` |