This file contains hidden or 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
// declare and assign new variable of type Random | |
Random r = new Random(); | |
// declare an int & assign it a random value between 1 and 10 (inclusive) | |
int intRandomNumber = r.Next(10) + 1; |
This file contains hidden or 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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace ConsoleQuiz3 { | |
class Program { | |
static void Main(string[] args) { | |
List<Pasta> pastas = Pasta.ServeDinner(); |
This file contains hidden or 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
// watch for changes to motivations select | |
$('#motivations').change(function() { | |
var selected = []; // create an array to hold all currently selected motivations | |
// loop through each available motivation | |
$('#motivations option').each(function() { | |
// if it's selected, add it to the array above | |
if (this.selected) { | |
selected.push(this.value); | |
} |
This file contains hidden or 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
// declare a list of ints | |
List<int> ints = new List<int>(); | |
// add some values to our list | |
ints.Add(13); | |
ints.Add(78); | |
ints.Add(3); | |
ints.Add(45); | |
ints.Add(22); |
This file contains hidden or 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
<?php | |
require_once('../app/app.db.php'); | |
require_once('../lib/class.db.php'); | |
// array to hold results | |
$results = array(); | |
// make sure we have an action | |
if (array_key_exists('action', $_REQUEST)) : | |
$actions = explode('|', strtolower($_REQUEST['action'])); |
This file contains hidden or 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
/* | |
A multi-line comment | |
Program Description: | |
A script that will display an alert box on Tuesday. Hot stuff. | |
*/ | |
// declare variable | |
var current_day; |
This file contains hidden or 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>Basic HTML5 Template</title> | |
</head> | |
<body> | |
<aside class="message">Hey, pay attention to me.</aside> | |
<article id="article1"> |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>DOM Demo</title> | |
</head> | |
<body> | |
<form id="form1"> | |
<input type="text" id="user_name" value="" /> | |
<button type="submit" id="submit">Get It</button> | |
</form> |
This file contains hidden or 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
// declare our variables | |
var r, random, max = 20; | |
// get a random number between 0 (inclusive) and 1 (exclusive) | |
r = Math.random(); | |
console.log(r); | |
// get a random number less than the maximum | |
random = max * r; |
This file contains hidden or 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 name = "Nasir Jones"; | |
// does the name contain 'Mike'? | |
var name_lcase = name.toLowerCase(); // converts string to lower case - easier for comparison | |
console.log(name_lcase); // nasir jones | |
var is_mike = name_lcase.indexOf('mike'); // returns the position of the given string - return -1 if not found | |
console.log(is_mike); // -1 |
OlderNewer