Skip to content

Instantly share code, notes, and snippets.

View twhite96's full-sized avatar
☢️
Cookin

tiff twhite96

☢️
Cookin
View GitHub Profile
// Bonfire: Repeat a string repeat a string
// Author: @twhite96
// Challenge: http://www.freecodecamp.com/challenges/bonfire-repeat-a-string-repeat-a-string?solution=function%20repeat(str%2C%20num)%20%7B%0A%20%20%2F%2F%20repeat%20after%20me%0A%20%20var%20newString%20%3D%20%22%22%3B%0A%20%20while%20(num%20%3E%200)%20%7B%0A%20%20%20%20newString%20%2B%3D%20str%3B%0A%20%20%20%20num--%3B%0A%20%20%7D%0A%20%20return%20newString%3B%0A%7D%0A%0Arepeat(%22abc%22%2C%203)%3B%0A
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function repeat(str, num) {
// repeat after me
var newString = "";
while (num > 0) {
newString += str;
@twhite96
twhite96 / traffic-light-demo.pde
Created April 4, 2016 00:09
Traffic Light Sim for Arduino
/*
Traffic Light Demo
*/
bool testMode = false;
// First light
int firstLightGreen = 3;
int firstLightYellow = 4;
int firstLightRed = 5;
@twhite96
twhite96 / app.js
Created April 30, 2016 23:16
Quiz app
//Create Questions
var questions = [
new Question("Who was the first President of the United States?", [ "George Washington", "Thomas Jefferson" ], "George Washington"),
new Question("What is the answer to the Ultimate Question of Life, the Universe, and Everything?", ["Pi","42"], "42")
];
//Create Quiz
var quiz = new Quiz(questions);
//Display Quiz
@twhite96
twhite96 / chunky_monkey.js
Created June 18, 2016 03:28
Chunky Monkey algorithm Free Code Camp solution
function chunkArrayInGroups(arr, size) {
var newArray = [];
var oldArray = arr.length/size;
for (var i = 0; i < oldArray; i++) {
var array = arr.splice(0, size);
newArray.push(array);
}
return newArray;
@twhite96
twhite96 / download_egghead_videos.md
Created June 18, 2016 04:02 — forked from nhtera/download_egghead_videos.md
download egghead videos
@twhite96
twhite96 / slasher_flick.js
Created June 18, 2016 22:45
Slasher Flick Free Code Camp Algorithm
function slasher(arr, howMany) {
// it doesn't always pay to be first
arr.splice(0, howMany);
return arr;
}
slasher(["burgers", "fries", "shake"], 1);
@twhite96
twhite96 / mutations.js
Created June 18, 2016 23:33
Mutations Free Code Camp Algorithm
function mutation(arr) {
var arr1 = arr[1].toLowerCase();
var arr2 = arr[0].toLowerCase();
for (var i = 0; i < arr1.length; i++) {
if (arr2.indexOf(arr1[i]) < 0)
return false;
}
return true;
@twhite96
twhite96 / link_scraping_script.py
Last active June 19, 2016 04:14
Link scraper
@twhite96
twhite96 / image_scraping_script.py
Last active June 19, 2016 04:15
Web Image Scraper
import urllib2
resp = urllib2.urlopen('http://testurl.com')
from bs4 import BeautifulSoup
soup = BeautifulSoup(resp.read())
images = soup.find_all('img')
foreach images in image:
@twhite96
twhite96 / styleGuide.md
Created August 31, 2016 02:47 — forked from matty-digital/styleGuide.md
Style guide for writing code in cs0134 and cs1520

Introduction

This is the style guide that you will be required to follow for any and all code submissions in this class. There is a very good chance that, should you decide to venture out into the wild and develop software professionally, you will be required to follow some sort of coding standard. All submissions must adhere to this style guide, if they don't there will be penalties up to and including the submission not being accepted or cosidered for a grade. You're in luck though, as this is a relatively easy style guide to follow. Suggestions are always welcome and above all else, even if you hate style guides and vow solemnly never to follow one again in your whole life...just make sure your code is consistent. Your future self will thank you. On a side note, it will be relatively apparent to me if you don't follow the style guide.

If changes are made to this guide throughout the semester, I will be sure to let you know and discuss the change with you.

General

Indentation