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/env python | |
# Python 2.7.9 | |
print "Hello world!" |
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 palindrome(str) { | |
tempStr = str.replace(/(\.|,|\s|_|:|;|\(|\)|\/|-)/g, "").toLowerCase(); | |
return tempStr.split("").reverse().join("") == tempStr; | |
} |
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
// Bonfire: Reverse a String | |
// Author: @erictleung | |
// Challenge: http://www.freecodecamp.com/challenges/bonfire-reverse-a-string | |
// Learn to Code at Free Code Camp (www.freecodecamp.com) | |
function reverseString(str) { | |
return str.split("").reverse().join(""); | |
} | |
reverseString("hello"); |
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 factorialize(num) { | |
var final = 1; | |
if (num === 0) { | |
return 1; | |
} | |
else { | |
for (i = 1; i <= num; i++ ) { | |
final *= i; | |
} | |
return final; |
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 | |
# Shell script to install Python | |
# Note: Change `wget` download file as necessary (also not validated, yet) | |
# https://my.bluehost.com/cgi/help/python-install | |
# download, unzip, and setup Python | |
mkdir ~/python | |
cd ~/python | |
wget http://www.python.org/ftp/python/2.7.2/Python-2.7.2.tgz | |
tar zxfv Python-2.7.2.tgz |
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 findLongestWord(str) { | |
var splitStr = str.split(" "); | |
var long = 0; | |
for (i = 0; i < splitStr.length; i++) { | |
if (splitStr[i].length > long) { | |
long = splitStr[i].length; | |
} | |
} | |
return long; | |
} |
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 titleCase(str) { | |
var splitStr = str.split(" "); | |
var newStr = []; | |
for (i = 0; i < splitStr.length; i++) { | |
var temp = splitStr[i]; | |
var fullTemp = temp[0].toUpperCase() + temp.substr(1, temp.length).toLowerCase(); | |
newStr.push(fullTemp); | |
} | |
return newStr.join(" "); | |
} |
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 end(str, target) { | |
return str.substr(str.length - target.length) == target; | |
} |
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 chunk(arr, size) { | |
var final = []; | |
for (i = 0; i < Math.ceil(arr.length/size); i++) { | |
final.push(arr.slice(i*size, (i+1)*size)); | |
} | |
return final; | |
} | |
chunk(["a", "b", "c", "d", "e"], 2); // returns [["a", "b"], ["c", "d"], ["e"]] |
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 rot13(str) { // LBH QVQ VG! | |
var output = ""; | |
for (var i = 0; i < str.length; i++) { | |
console.log("We are in loop " + i); | |
var ascii = str[i].charCodeAt(); | |
console.log("Ascii value: " + ascii); | |
// Check if character is alphabetical or not | |
if (ascii <= 90 && ascii >= 65) { | |
console.log("Character is part of alphabet"); |
OlderNewer