This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
//global var set up | |
var debugMode = false; | |
var userGuess = 0; | |
var gameWon = false; | |
var triesUsed = 0; | |
var triesAllowed = 2; | |
var triesRemaining = triesAllowed; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
var debugMode = false; | |
function Game(tries) { | |
this.triesAllowed = tries; | |
var userGuess = 0; | |
var gameWon = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- 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 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var str = ""; | |
var params = { | |
3:"fizz", | |
5:"buzz", | |
8:"chocolate" | |
}; | |
for (var i = 0; i < 100; i ++ ) { | |
str = i + " "; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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' ); |
OlderNewer