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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 | |
$phone = array( 'HTC', 'One M8', 'Android' ); | |
list($brand, $model , $os ) = $phone; | |
//echos "I have a HTC One M8 running Android." | |
echo "I have a $brand $model running $os."; |
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 | |
//Describes phone | |
$brand = "HTC"; | |
$model = "One M8"; | |
$os = "Android"; | |
//Creates the phone array using the variables above as key value pairs. | |
$phone = compact("brand", "model" , "os"); |
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 | |
//Describes phone | |
$brand = "HTC"; | |
$model = "One M8"; | |
$os = "Android"; | |
//Sets each string to a key value pair in an array. | |
$phone = compact("brand", "model" , "os"); |
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
$(document).ready(function(){ | |
$(#somefunction) | |
}); |
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
//Set $ as a wrapper for jQuery | |
jQuery(document).ready(function($){ | |
//Everything inside this function can use the $ wrapper to call jQuery. | |
$(#somefunction) | |
}); |
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
//Reassign jQuery call to a variable. | |
var $j = jQuery; | |
//Then use the variable as a wrapper for the jQuery call. | |
$j(#somefunction); |
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 single class method chaining | |
class stringExample | |
{ | |
private $str; | |
function __construct() | |
{ | |
$this->str = ''; |
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
set_transient( $transient , $value , $expiration); | |
$transient //This is a string that will be used as a unique identifier for your cached data. It must be less than 45 characters. | |
$value //This will be an array, object, or variable you wish to cache. | |
$expiration //An integer of the maximum of seconds to keep the data before expiring. |
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 | |
class Phone | |
{ | |
//Creating private properties | |
private $_type; | |
private $_os; | |
public function setType( $type ) |
OlderNewer