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 | |
//FILE: legacy-application/public/index.php | |
require_once __DIR__ . '/../vendor/autoload.php'; | |
$config = require __DIR__ . '../config/settings.php'; | |
$counties = require __DIR__ . '/../vendor/my-company/my-package/src/counties.php'; | |
$app = \App\Application::createFromConfig($config, $counties); |
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 | |
//FILENAME: /spaghetti-monster/src/Application.php | |
namespace SpaghettiMonster; | |
use SpaghettiMonster\Domain\EntityRepository; | |
use SpaghettiMonster\Domain\EntitySearch; | |
use SpaghettiMonster\Domain\EntityUpdater; | |
use SpaghettiMonster\Domain\Twitter\ApiClient; | |
use SpaghettiMonster\Domain\Twitter\TweetCreator; |
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 'setup/connection.php'; //returns a PDO instance; | |
$searchTerm = isset($_GET['search']) ? $_GET['search'] : null; | |
$currentPage = isset($_GET['page']) ? $_GET['page'] : 1; | |
//Step 1: Get the total number of results for a search | |
$sqlParams = []; | |
$totalResultSql = 'SELECT COUNT(*) AS count FROM articles '; | |
if ($searchTerm) { | |
$sqlParams['search'] = "%$searchTerm%"; |
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 | |
namespace App\Tests\Domain\Twitter; | |
use App\Domain\Twitter\TwitterProfile; | |
class TwitterProfileTest extends \App\Tests\BaseUnitTest | |
{ | |
private $accessToken = 'oauth-token'; | |
private $accessSecret = 'oauth-secret'; |
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 | |
/** | |
* Example of a PHP class that stores dynamic properties in an array, and then can be used to create a SQL statement | |
* | |
* I would consider this a proof-of-concept and I do not believe this is a good practice | |
*/ | |
class User | |
{ | |
/** | |
* @var array Object attributes |
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 | |
/* | |
The question: | |
if ( $date_text == 'Sunday' ){ | |
$sql = "update table set sun = $date where "id ='$_REQUEST[num]"; | |
$sql1= "update table set sun = $date where "id ='$_REQUEST[num1]"; | |
mysql_query($con,$sql); | |
mysql_query($con,$sql1); | |
} |
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 | |
//FILE LOCATION: project-directory/config/bootstrap.php | |
declare(strict_types=1); | |
//Composer autoloader file | |
require_once __DIR__ . '/../vendor/autoload.php'; | |
error_reporting(E_ALL | E_NOTICE); | |
//Load the files required for configuration | |
$configuration = require __DIR__ . '/settings.php'; | |
$countyList = require __DIR__ . '/../vendor/some-other-package/list-of-tennessee-counties.php'; |
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
// ==UserScript== | |
// @name Trending Now No More | |
// @namespace http://tampermonkey.net/ | |
// @version 1.0 | |
// @description Removes the Trending Now section on Twitter | |
// @author Sean Mumford | |
// @match https://twitter.com/* | |
// @grant none | |
// ==/UserScript== |
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 | |
/** | |
* Validates a value based on its length as a string | |
* | |
* ```php | |
* $toBeValidated = 17; | |
* $validationParameters = [ | |
* 'min' => 10 | |
* ]; |
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 | |
$SQL = "SELECT inv.*, COUNT(*) OVER() AS totalrows FROM stones inv WHERE wt >= 2.5"; | |
if (isset($_POST["ItemSearch"])) $SQL .= "AND number LIKE '" . $_POST["ItemSearch"] . "%'"; | |
if (isset($_POST["minimum_wt"], $_POST["maximum_wt"]) && !empty($_POST["minimum_wt"]) && !empty($_POST["maximum_wt"])) $SQL .= "AND wt BETWEEN '" . $_POST["minimum_wt"] . "' AND '" . $_POST["maximum_wt"] . "'"; | |
if (isset($_POST["shape"])) { |