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 FirstLetterCapitalise(message) { | |
if((typeof message === "undefined") || (typeof message !== "string")) { | |
return "You have to pass in a string."; | |
} else { | |
var buffer, blength, newbuf, newstr, nblength, char, result; | |
buffer = message.split(" "); | |
blength = buffer.length; | |
result = ""; | |
for(var i = 0; i < blength; i++) { | |
char = buffer[i].charAt(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 addFromOneToNum(num) { | |
var output; | |
output = num; | |
for(var i = 1; i < num; i++) { | |
output += i; | |
} | |
return output; | |
} |
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 letterShifter(message) { | |
var lc_alphabet, uc_alphabet, lc_key, uc_key, coded, i, ch, index; | |
lc_alphabet = "abcdefghijklmnopqrstuvwxyz"; | |
uc_alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; | |
lc_key = "bcdefghijklmnopqrstuvwxyza"; | |
uc_key = "BCDEFGHIJKLMNOPQRSTUVWXYZA"; | |
coded = ""; | |
for(i = 0; i < message.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
function reverseString(str) { | |
var output; | |
if((typeof str === "undefined") || (typeof str !== "string")) { | |
return "You have to pass a string as an argument." | |
} | |
output = str.split("").reverse().join(""); | |
return output; | |
} |
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 factorial(num) { | |
// If the number is less than 0, reject it. | |
if (num < 0) { | |
return "You can't do a factorial on negative numbers."; | |
} | |
// If the number is 0, its factorial is 1. | |
else if (num == 0) { | |
return 1; | |
} | |
var output = num; |
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 LongestWord(sen) { | |
if(typeof sen = "undefined") { | |
return "You have to pass a sentence in as a string."; | |
} else { | |
var words = sen.split(" "); | |
if(words.length = 1) { | |
return words[0]; | |
} else { | |
var largest = 0; | |
var output = ""; |
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
<head> | |
<meta name="csrf-param" content="authenticity_token"/> | |
<meta name="csrf-token" content="xpGnHlrBwMt4Sski2rk7xIKRT50B4KgNYXmlk3FY6wA="/> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=2.0" /> | |
<meta http-equiv="Expires" content="Thu, 01 Jan 1970 00:00:00 GMT"/> |
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
## Colours and font styles | |
## Syntax: echo -e "${FOREGROUND_COLOUR}${BACKGROUND_COLOUR}${STYLE}Hello world!${RESET_ALL}" | |
# Escape sequence and resets | |
ESC_SEQ="\x1b[" | |
RESET_ALL="${ESC_SEQ}0m" | |
RESET_BOLD="${ESC_SEQ}21m" | |
RESET_UL="${ESC_SEQ}24m" | |
# Foreground colours |