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
function() { | |
function piratify(str) { | |
return str.replace(/pp/gi, "(pp)"); | |
} | |
var tags = ['p','li','h1','h2','h3','h4','h5','h6','td','th']; | |
var texts = []; | |
for(var i = 0; i < tags.length; i++) { | |
texts = document.getElementsByTagName(tags[i]); |
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
Array.prototype.each = function(callback) { | |
var i = this.length, j = 0; | |
while(i--) { | |
callback.call(this, this[j++]); | |
} | |
}; | |
Array.prototype.contains = function(needle) { | |
var contains = false; |
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
function formatString(str, values) { | |
for(var i in values) { | |
var pattern = /{/.source +i+ /}/.source; | |
str = str.replace(pattern, values[i]); | |
} | |
return str; | |
} | |
var str = "{fältnamn} är {typ}, var vänlig fyll i!"; |
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
var lines = document.getElementById('textArea').value.split("\n"); | |
var prev = 0, str = "", blankLines = 0, total = ""; | |
for(var n in lines) { | |
str = b[n]; | |
if(str === "") { | |
blankLines++; | |
if(n == (lines.length-1) && blankLines !== 0) { |
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
// ----- SÅHÄR GÖR JAG NU ----- | |
while(doc != null) | |
{ | |
// söker i hela databasen varje gång | |
Document searchDoc = someDatabase.search("MYFIELD=\""+ doc.getItemValueString("MYFIELD") +"\"").getFirstDocument(); | |
// jobba med dokumentet... | |
doc = someView.getNextDocument(doc); | |
} |
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
# finds files that by filename matches $1, does not reside in a target folder, and contains the string $2 | |
findgrep() { | |
find . -name "*$1*" -and -type f -and -not -path "*/target/*" -and -not -path "*/.git/*" -print0 | xargs -0 fgrep -n --color=auto "$2" | |
} | |
# searches pom.xml files for $1 | |
alias poms="findgrep 'pom.xml' $1" | |
# copies the output of the last command to the clipboard | |
copylast() { |
NewerOlder