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
// --- Processing ---// | |
/* | |
Declare and construct an object from the class HLine | |
Processing requires that you state the type of a variable when you initialize it. | |
The type here is HLine | |
*/ | |
HLine h1 = new HLine(20, 2.0); | |
// show the ypos property of h1 | |
print(h1.ypos); |
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
<?php | |
// --- PHP --- // | |
// Declare and construct an object from the class HLine | |
// PHP doesn't care whether the parameters are ints or strings | |
$h1 = new HLine(20, 'meow'); | |
// show the ypos property of h1 | |
echo $h1->ypos; | |
class HLine{ | |
/* |
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
<?php | |
//For more info, see: http://us1.php.net/manual/en/pdo.construct.php | |
/* Connect to an ODBC database using driver invocation */ | |
$dsn = 'mysql:dbname=testdb;host=mysql.yourdomain.com'; | |
$user = 'dbuser'; | |
$password = 'dbpass'; | |
try { | |
// create PDO object (stands for PHP Data Object, fyi) |
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
<?php | |
/* | |
OpenWeatherMap API example | |
See documentation for more info: http://openweathermap.org/API | |
*/ | |
/* | |
Get the 7-day forecast for London in imperial (Fahrenheit) units, with response in JSON format: | |
Parameters in query string: | |
q=London : search string |
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
<?php | |
/* | |
Example of accessing the Google Geocoding API and getting results in XML | |
Info here: https://developers.google.com/maps/documentation/geocoding/ | |
*/ | |
$base_url = 'http://maps.googleapis.com/maps/api/geocode/'; | |
$format = 'xml'; // 'xml' or 'json' | |
$address = 'address='.urlencode('350 5th Avenue New York, NY'); // makes the text URL friendly, ie, 350+5th+Avenue+New+York%2C+NY | |
$url = $base_url.$format.'?'.$address.'&sensor=false'; // Google requires 'sensor=false' parameter |
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
<html> | |
<head> | |
<title>The Top Bar Title</title> | |
</head> | |
<body> | |
<p>Some information</p> | |
<!-- We're about to start PHP --> | |
<? php // We're in PHP now. | |
// assign some variables -- variables in PHP start with a dollar sign ($) |
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
<?php | |
/* | |
Add a new line to a file that contains records of names and phone numbers | |
For example, the file might be called clients.txt and look like this: | |
Chan,Roger,345-9876 | |
Garcia,Victoria,456-1234 | |
Stevens,Julie,678-9872 | |
*/ |
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
{ | |
"meta": { | |
"code": 200 | |
}, | |
"response": { | |
"neighborhoods": [], | |
"venues": [{ | |
"id": "4b8aa3e1f964a520e77632e3", | |
"name": "NYU Stern School of | |
Business", |
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
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<title>The colors of weather</title> | |
<?php | |
$temp = 45; | |
$conditions = 'rain'; | |
/* |
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
<!doctype html> | |
<html lang="en-US"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="Content-Type" content="text/html"> | |
<!-- css and js references are just placeholders here. add your own --> | |
<link rel="stylesheet" type="text/css" media="all" href="css/style.css"> | |
<script type="text/javascript" src="js/jquery-1.10.2.min.js"></script> | |
<script type="text/javascript" src="js/myscript.js"></script> | |
<title>HTML5</title> |
OlderNewer