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 / fizzbuzzchocolate.js
Created September 3, 2014 03:13
Fizz Buzz Chocolate
var str = "";
var params = {
3:"fizz",
5:"buzz",
8:"chocolate"
};
for (var i = 0; i < 100; i ++ ) {
str = i + " ";
@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 / functions.php
Last active November 21, 2015 02:35
WordPress custom loop for use with the Genesis framework. Post titles display as a simple vertical list when viewing a category.
//Add this to the bottom of your functions.php file
//Must be using Genesis framework for WordPress
//This code will change your category pages to contain a simple list of your post titles as links
add_action( 'pre_get_posts', 'mjg_show_titles_only_category_pages' );
function mjg_show_titles_only_category_pages( $query ) {
if( $query->is_main_query() && $query->is_category() ) {
$query->set( 'orderby', 'title' );