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\Providers; | |
use Illuminate\Support\ModuleServiceProvider; | |
class FooModuleServiceProvider extends ModuleServiceProvider | |
{ | |
protected $moduleName = 'Foo Module'; | |
protected $moduleNamespaces = ['App\FooModule']; | |
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 MyAppName\Http\Requests\Members; | |
use Illuminate\Contracts\Validation\Validator; | |
use InternalPackage\Laravel\Traits\SessionFlashNotifierTrait; | |
use MyAppName\Http\Requests\Request; | |
class ImportMembersRequest extends Request | |
{ | |
use SessionFlashNotifierTrait; |
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 | |
use AppName\Posts\Post; | |
use Illuminate\Http\Request; | |
class GenericAclMiddleware | |
{ | |
private $entityClasses = [ | |
'post' => Post::class | |
]; |
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 | |
//namespaces and imports excluded for brevity | |
abstract class AbstractImporter implements Importer | |
{ | |
/** | |
* @var ImportTransformer | |
*/ | |
private $transformer; | |
/** |
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 | |
//Created as an alternative to an article demonstrating the use of regular expressions to parse HTML: | |
// http://www.web-development-blog.com/archives/parse-html-with-preg_match_all/ | |
/** | |
* @param string $remoteUrl | |
* @param string $yourLink | |
* @return bool | |
*/ | |
function check_back_link($remoteUrl, $yourLink) |
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 MyApp\Domain; | |
class CountyElectionResult | |
{ | |
/** | |
* @var string | |
*/ | |
private $county; |
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
//Vintage Jquery 1.3 | |
$.post("DataFiles/Registration.ashx", | |
{ | |
//Actual values sent to the server are formatted are broken into 3 segments, separated by a tilde | |
//The first is the type to which the value should be cast at the server, the second the actual value | |
//The third segment, "fin" specifies the server should not validate or update those fields | |
//We have the best code. Tremendous code, people tell me all the time. | |
new_ncoqfrname: $("#txtRegNo").attr("type") + "~" + $("#txtRegNo").val() + "~fin", | |
new_federalidfein: $("#new_federalidfein").attr("type") + "~" + $("#new_federalidfein").val() + "~fin", | |
new_ncoqfrfinancialperiodstartdate: "datetime" + "~" + $("#new_ncoqfrfinancialperiodstartdate").val() + "~fin", |
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 | |
//Define how each POST field is validated | |
$fieldValidation = [ | |
'username' => 'required', | |
'first_name' => 'required', | |
'last_name' => 'required', | |
'website' => 'website', | |
'email' => 'email', | |
'pass' => 'password', |
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 | |
//Formatting and indentation unchanged from original file | |
$find = $_GET['find']; | |
$browse = $_GET['browse']; | |
//More awful code ommitted to preserve the sanity of readers | |
if(isset($find)) { | |
$find = addcslashes(mysql_real_escape_string($find), "%_"); | |
$rs = new MySQLPagedResultSet("SELECT * FROM TableName WHERE MATCH (Name) AGAINST ('$find' IN BOOLEAN MODE) ORDER BY Name ASC", 100, $dbConnect); | |
} |
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 | |
trait GeneratesPermutationsTrait | |
{ | |
/** | |
* Generates an array with N unique combinations of inputs and a unique output, where N is equal to 2^count($params) | |
* For example, generatePermutations([], 'Param 1', 'Param 2') would return something similar to: | |
* [ | |
* [ | |
* 'inputs' => ['Param 1v1', 'Param 2v1'], |