Skip to content

Instantly share code, notes, and snippets.

View peterfschaadt's full-sized avatar

Peter Schaadt peterfschaadt

View GitHub Profile
1. Create a function with a loop that prints out only the odd positioned elements of an array that it takes in.
2. Create a function with a loop that prints out only the even numbers of an array that consists of only numbers.
3. Create a function that takes in two arguments, one is an array and one is a string. The function should loop through the array and return true for each time that the string matches the element the function is looping through.
4. Use JavaScript's random function inside a while loop to run the loop as long as your variable doesn't equal exactly 50. Limit your random sample to 1-100. Each time the loop runs, print something like this to the console: console.log(runValue + " doesn't equal 50, Run #" + runNumber).
Hints:
- You'll have to increment
@peterfschaadt
peterfschaadt / widget.html
Last active August 29, 2015 14:06
supportscheduler - contact us TPA HTML
<!DOCTYPE html>
<html>
<head>
<title>Wix Contact Us App</title>
<style type="text/css">
body {
background: transparent;
margin: 0;
}
@peterfschaadt
peterfschaadt / contact-us-app.js
Last active August 29, 2015 14:06
supportscheduler - contact us TPA JS
var contactApp = (function (window, Wix, undefined) {
'use strict';
var basePath = 'http://dev-contact.apps.wix.com/',
buttonUrl = {
en: 'http://static.wix.com/media/7532433974faf66715759e54072a9990d923cdd4.png',
pt: 'http://static.wix.com/media/161001484b3648b07d21208277ed558d4b2ce1e55.png',
es: 'http://static.wix.com/media/44547837819ec7fceb4622732e06114447194e6b.png'
};
// var userCookie = readCookie('wixSession');
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
}