Skip to content

Instantly share code, notes, and snippets.

View twhite96's full-sized avatar
☢️
Cookin

tiff twhite96

☢️
Cookin
View GitHub Profile
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="css/main.css">
<title>The Story Maker</title>
</head>
<body>
<div class="container">
<h1>The Story Maker</h1>
<script src="story.js"></script>
@twhite96
twhite96 / gist:ec30aa07a1a039ef3927
Created September 23, 2015 01:59
Google Contacts API v3 Javascript sample
<html>
<head>
<script src="https://apis.google.com/js/client.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script>
function auth() {
var config = {
'client_id': 'OAUTH_CLIENT_ID',
'scope': 'https://www.google.com/m8/feeds'
};
@twhite96
twhite96 / White.java
Last active October 4, 2015 23:33
Java Program for class
import java.util.Scanner;
import java.io.*;
public class White
{
public static void main(String[] args) throws IOException
{
// Gets the PrintWriter and Scanner classes
PrintWriter file = new PrintWriter("names.txt");
Scanner keyboard = new Scanner(System.in);
@twhite96
twhite96 / Template_string.js
Created October 24, 2015 22:03
Template_string.js
//first, checks if it isn't implemented yet
if (!String.prototype.format) {
String.prototype.format = function() {
var args = arguments;
return this.replace(/{(\d+)}/g, function(match, number) {
return typeof args[number] != 'undefined'
? args[number]
: match
;
});
// Bonfire: Reverse a String
// Author: @twhite96
// Challenge: http://www.freecodecamp.com/challenges/bonfire-reverse-a-string?solution=function%20reverseString(str)%20%7B%0A%20%20str%20%3D%20str.split(%27%27)%3B%0A%20%20str%20%3D%20str.reverse()%3B%0A%20%20str%20%3D%20str.join(%27%27)%3B%0A%20%20return%20str%3B%0A%7D%0A%0A%0A%0A%0A%0AreverseString(%22hello%22)%3B%0A
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function reverseString(str) {
str = str.split('');
str = str.reverse();
str = str.join('');
return str;
// Bonfire: Factorialize a Number
// Author: @twhite96
// Challenge: http://www.freecodecamp.com/challenges/bonfire-factorialize-a-number?solution=function%20factorialize(num)%20%7B%0A%20%20if%20(num%20%3D%3D%3D%200)%20%7B%0A%20%20%20%20return%201%3B%0A%20%20%7D%0A%20%20%20%20return%20num%20*%20factorialize(num%20-%201)%3B%0A%7D%0A%0Afactorialize(5)%3B%0A
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function factorialize(num) {
if (num === 0) {
return 1;
}
return num * factorialize(num - 1);
// Bonfire: Check for Palindromes
// Author: @twhite96
// Challenge: http://www.freecodecamp.com/challenges/bonfire-check-for-palindromes?solution=function%20palindrome(str)%20%7B%0A%20%20%2F%2F%20Good%20luck!%0A%20%20%0A%20%20str%20%3D%20str.toLowerCase()%3B%0A%20%20%0A%20%20str%20%3D%20str.replace(%2F%5B%5Ea-z%7C1-9%5D%2Fg%2C%20%22%22)%3B%0A%20%20%0A%20%20if%20(str.length%20%3D%3D%3D%200)%7B%0A%20%20%20%20return%20true%3B%0A%20%20%7D%0A%20%20%0A%20%20if%20(str%5B0%5D%20!%3D%3D%20str%5Bstr.length-1%5D)%7B%0A%20%20%20%20return%20false%3B%0A%20%20%7D%0A%20%20%0A%20%20else%20%7B%0A%20%20%20%20return%20palindrome(str.slice(1%2Cstr.length%20-%201))%3B%0A%20%20%7D%0A%7D%0A%0A%0Apalindrome(%22eye%22)%3B%0A
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function palindrome(str) {
str = str.toLowerCase().replace(/[\W_]/g, '');
for(var i = 0, len = str.length - 1; i < len/2; i++) {
if(str[i] !== str[len-i]) {
return false;
// Bonfire: Find the Longest Word in a String
// Author: @twhite96
// Challenge: http://www.freecodecamp.com/challenges/bonfire-find-the-longest-word-in-a-string?solution=function%20findLongestWord(str)%20%7B%0A%20%20var%20words%20%3D%20str.split(%27%20%27)%3B%0A%20%0A%20%20var%20longest%20%3D%200%3B%0A%20%20%0A%20%20for%20(var%20i%20%3D%200%3B%20i%20%3C%20words.length%3B%20i%2B%2B)%20%7B%0A%20%20%20%20if%20(words%5Bi%5D.length%20%3E%20longest)%20%7B%0A%20%20%20%20%20%20longest%20%3D%20words%5Bi%5D.length%3B%0A%20%20%20%20%7D%0A%20%20%20%20%0A%20%20%7D%0A%20%20%0A%20%20%20%20%20%20return%20longest%3B%0A%7D%0A%0AfindLongestWord(%22The%20quick%20brown%20fox%20jumped%20over%20the%20lazy%20dog%22)%3B%0A
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function findLongestWord(str) {
var words = str.split(' ');
var longest = 0;
// Bonfire: Title Case a Sentence
// Author: @twhite96
// Challenge: http://www.freecodecamp.com/challenges/bonfire-title-case-a-sentence
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function titleCase(str) {
// Made the string an array
var arrayList = str.split(' ');
// Bonfire: Return Largest Numbers in Arrays
// Author: @twhite96
function largestOfFour(arr) {
// You can do this!
//Need a place to store the solution
var results = [];