Skip to content

Instantly share code, notes, and snippets.

View fd's full-sized avatar
🏳️‍🌈
Unstoppable

Simon Menke fd

🏳️‍🌈
Unstoppable
View GitHub Profile
var ModuleA = require('module-a');
var ModuleB = require('module-b');
var A = new ModuleA("A"),
B = new ModuleB("B");
A.foo() // => "foo"
A.bar() // => [error]
A.getName() // => "A"
@fd
fd / glossary_regexp.rb
Created August 29, 2011 08:09
Glossary Regexp
description = file.description.clone
@glossary.each do |w|
terms = w.name.split(',')
terms.each do |term|
term = Regexp.escape(term.strip).gsub('\ ', '\s+')
description.gsub!(/(\b#{term}\b)/i, "<acronym rel=\"#{w.id}\">\\1</acronym>")
end
end