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
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
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
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() { | |
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
#!/bin/bash | |
# edit this, should be login details for sms.se and your phone number | |
loginnumber="0701234567" | |
password="abc123" | |
sendTo="0701234567" | |
# you shouldn't have to edit anything beyond this point | |
if [ $# != 1 ]; then |
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
private class QueryParser { | |
public Hashtable parseQueryString(String qsd) { | |
// we will return this | |
Hashtable data = new Hashtable(); | |
// check if it contains pairs of k/v | |
if(qsd.indexOf("&") > -1) { | |
String[] pairs = qsd.split("&"); | |
for(int i = 0; i < pairs.length; 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
#!/bin/bash | |
wp_blogs=( | |
"/var/www/someblog/" | |
"/var/www/anotherblog/" | |
"/var/www/thirdblog/" | |
) | |
# get the latest wordpress files | |
echo "Downloading Wordpress and unpacking..." |
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 NotesName(p) { | |
var name = p; | |
// regular expressions that we use to extract information | |
var Regexp = { | |
abbreviated: /(?:CN|OU|O|C)=/gi, | |
isName: /CN=.+(?:\/OU=.+)*\/O=.+(?:\/C=.+)?/i, | |
common: /CN=([\w\s]*)\//i, | |
given: /^(\w+)\s/, | |
surname: /\s(\w+)$/, |
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 queryParam(key) { | |
// if it doesn't contain a question mark, return undefined | |
var qmPos = window.location.href.indexOf("?"); | |
if(qmPos === -1) { | |
return undefined; | |
} | |
// if it doesn't contain our key, also return undefined | |
var keyPos = window.location.href.indexOf(key+"=", qmPos); | |
if(keyPos === -1) { |
OlderNewer