Skip to content

Instantly share code, notes, and snippets.

View manderly's full-sized avatar

Mandi Burley manderly

View GitHub Profile
@manderly
manderly / guessCurrentDayNum.html
Last active August 29, 2015 14:02
Code Fellows Foundations 1 Homework Assignment 2: JavaScript guessing game prompts user to guess the current day of the year (out of 365)
<script>
//global var set up
var debugMode = false;
var userGuess = 0;
var gameWon = false;
var triesUsed = 0;
var triesAllowed = 2;
var triesRemaining = triesAllowed;
@manderly
manderly / randomPasswordGenerator
Created June 7, 2014 17:56
JavaScript random password generator
<script>
/*Random password generator
Set length to desired password length
Tell it if you want to include letters, capital letters, numbers, and symbols
Tell it if the password MUST require a capital letter, number, or symbol
Drag into browser to generate a password
*/
var length = 10;
var lettersAllowed = true;
@manderly
manderly / dayNumGuessAsObject
Created June 10, 2014 18:24
Code Fellows Foundations 1 Number Guessing Game adapted into instantiated object with customizable "guesses allowed" property
<script>
var debugMode = false;
function Game(tries) {
this.triesAllowed = tries;
var userGuess = 0;
var gameWon = false;
@manderly
manderly / Foundations2_preferredNameDemo
Created July 8, 2014 17:56
Code Fellows Foundations 2: preferredName() HTML Demo
<!-- Created for Code Fellows Foundations 2 as a working demonstration of preferredName()-->
<html>
<script>
var firstName = prompt("Please enter a first name: ");
var lastName = prompt("Please enter a last name: ");
var preferredName = function (firstName,lastName) {
if (firstName || lastName) {
alert( ((firstName && lastName) ? false : firstName || lastName));
} else {
@manderly
manderly / casperjstest.js
Last active August 29, 2015 14:05
CasperJS test exercise
casper.test.begin("Testing if node express app", 2, function suite(test) {
casper.start('http://localhost:3000', function() {
test.assertHttpStatus(200);
});
casper.then(function() {
if (this.fetchText('.daysLeft') > 0) { //todo: parse as int?
this.echo("more than 0 days left");
}
this.echo("Days left: " + this.fetchText('.daysLeft'));
@manderly
manderly / Highest_Fibonacci_Number_Under_100
Created September 12, 2014 16:17
JavaScript exercise: Find the highest Fibonacci number under 100
//Return to me the highest Fibonacci number between 0 and 100
//1,2,3,5,8,13,21,34,55,89
var sum = 0;
var arr = [];
var fibo = function(num1, num2) {
sum = num1 + num2;
console.log('num1: ' + num1 + ' + num2: ' + num2 + ' = sum: ' + sum);
@manderly
manderly / fibo_under_max_num
Created September 13, 2014 04:05
Highest Fibonacci number under maxNum (improved)
//Return to me the highest Fibonacci number under 100
//0,1,1,2,3,5,8,13,21,34,55,89
var maxNum = 100;
var sum = 0;
var findHighestFiboUnder = function(max, num1, num2) {
//allows num1 and num2 to be optional
num1 = typeof num1 !== 'undefined' ? num1: 1;
num2 = typeof num2 !== 'undefined' ? num2: 1;
sum = num1 + num2;
@manderly
manderly / gist:db217926b02fef0b98b6
Created October 13, 2014 21:05
IonicOne WP Theme CSS for TowerSecrets
/*
Welcome to Custom CSS!
CSS (Cascading Style Sheets) is a kind of code that tells the browser how
to render a web page. You may delete these comments and get started with
your customizations.
By default, your stylesheet will be loaded after the theme stylesheets,
which means that your rules can take precedence and override the theme CSS
rules. Just write here what you want to change, you don't need to copy all
@manderly
manderly / cbm-ingredients
Created November 6, 2014 19:03
ChickenBreastMeals: Editable ingredients list created with ng-repeat
<h2>Ingredients</h2>
<ol class="ingredients-list">
<!-- loop through and display existing ingredients -->
<li data-ng-repeat="ingredient in formMeal.ingredients track by $index">
<textarea name="ingredientLines"
type="text"
data-ng-model="formMeal.ingredients[$index].name"
placeholder="Add ingredient"
data-ng-change="changeIngredient($index)"
></textarea>
@manderly
manderly / gist:9db712804d635a0f23ec
Created November 7, 2014 03:12
CBM.com admin controller changeIngredient method
$scope.changeIngredient = function(index) {
if (index == $scope.formMeal.ingredients.length -1) {
$scope.formMeal.ingredients.push('');
}
};