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 Run | |
{ | |
public static function indexOfLongestRun($str) | |
{ | |
$strlen = strlen( $str ); | |
$strlen=$strlen-1; | |
$maxIndex = 0; |
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 src="https://code.jquery.com/jquery-1.11.0.js"></script> | |
<script type="text/javascript"> | |
<!-- | |
$(document).ready(function() { | |
//To gain acccess to DOM, place the function inside $(document).ready | |
registerClickHandler(); | |
function registerClickHandler() { |
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 src="https://code.jquery.com/jquery-1.11.0.js"></script> | |
<script type="text/javascript"> | |
<!-- | |
$(document).ready(function() { | |
registerHandlers(); | |
function registerHandlers() { | |
$('a').click(function(){ |
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 AreAnagrams | |
{ | |
public static function areStringsAnagrams($a, $b) | |
{ | |
return(count_chars($a, 1) == count_chars($b, 1)); | |
} | |
} | |
// For testing purposes (do not submit uncommented): |
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> | |
<meta charset="utf-8"> | |
<title>Widgets</title> | |
<script src="https://code.jquery.com/jquery-1.11.0.js"></script> | |
<script type="text/javascript"> | |
<!-- | |
$(document).ready(function() { |
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
-- Adminer 4.1.0 MySQL dump | |
SET NAMES utf8; | |
SET time_zone = '+00:00'; | |
SET foreign_key_checks = 0; | |
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO'; | |
DROP TABLE IF EXISTS `emp`; | |
CREATE TABLE `emp` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, |
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 Path { | |
public $currentPath; | |
function __construct($path) { | |
$this->currentPath = $path; | |
} | |
public function cd($newPath) { |
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 RPN | |
* Challenge: Create a 'Reverse Polish Notation' calculator in PHP | |
* @author Jorge A. Gonzalez <[email protected]> | |
* @copyright 2016 | |
*/ | |
class RPN |
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
// This gives us the opportunity to specify things like extra header | |
// information and page title and all that | |
$extra_head = 'heads'.$slash.$subdir.basename($safepage); | |
$js = 'js/'.$subdir.basename($safepage, '.php').'.js'; | |
$css = 'css/'.$subdir.basename($safepage, '.php').'.css'; | |
/* | |
* If we cannot find an individual controller files, search for controller files | |
* that will blanket the entire directory. Failing upwards. |
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 | |
/** | |
* Get additional products from a brand in associated categories | |
* @param $brand_id | |
* @param $product_id | |
* @param $category_ids | |
* @return $collection | |
*/ | |
public function getMoreFromBrand($brand_id, $product_id, $category_ids=0, $platform='desktop') { |