Skip to content

Instantly share code, notes, and snippets.

@moyix
Last active April 26, 2023 19:14
Show Gist options
  • Star 16 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moyix/dda9c3180198fcb68ad64c3e6bc7afbc to your computer and use it in GitHub Desktop.
Save moyix/dda9c3180198fcb68ad64c3e6bc7afbc to your computer and use it in GitHub Desktop.
PHP code generated by GPT-2
<?php
require ' vendor/autoload.php ' ;
/**
* Handles an HTTP request that contains information for registering/unregistering
* a FNA application.
*
* The service must call add_matching_service() to retrieve the matching service.
*
* @uses function_http_bundles::add_register()
*/
$app = new App ();
// All GET requests that come to add_register() will be sent to this service.
$api = $app -> include(' ' );
$api -> register( new DbAppAndFNAAppRegistrationService ());
// Define any services to register. We will override any present in the external
// DB have the class of .DAO .
$service = new AppAndFNAAppService ( $app , [
array ( ' host ' => ' localhost ' )
]);
$service -> register( $app , $api );
$app -> register( $service );
$app -> register( $this );
// This application will actually register itself as a DbAppAndFNAAppRegistrationService.
// That way we will be able to hook/build our own custom registration and callback
// handlers that will be sent to the DbAppAndFNAAppRegistrationService.
class Blah {
public function register ()
{
return new AppAndFNAAppRegistrationService ( $api , \ App :: toTts());
}
/**
* Create an FNA simple match API.
*/
public function toTts ()
{
if ( ! isset ( $this -> api )) {
return false ;
}
if ( ! isset ( $api -> registered )) {
return false ;
}
return $this -> api -> match( $this -> name , $this -> arguments , 33 );
}
/**
* Dump the indices of registered and unregistered services.
*
* @return array Dump service indexes
*/
protected function dump ( array $services )
{
$service = new AppAndFNAAppService ( $api , $services );
foreach ( $this -> registered as $service ) {
foreach ( $api -> registered as $service ) {
$components = $server_roundtrip -> getComponents( $service );
if ( is_bool ( $components instanceof FNAComponentsProvider )) {
// FNA components are DummyService or IoComponentsProvider (no third party DB)
foreach ( $components as $component ) {
$id = $component -> ref();
$component -> run( VOICE_SIMPLIFIED );
}
}
$services [ $service -> ref()][ $id ] = true ;
$services [ $service -> ref()][ $id ] = true ;
}
}
return $services ;
}
/**
* Register a custom handler to intercept MimeTags.
*
* @param IoApp $app An Io application.
*/
public function registerMimeTagInterceptor ( IoApp $app )
{
if ( ! isset ( $app -> mixins[ ' $matchSpec ' ])) {
$app -> mixins[ ' $matchSpec ' ] = new MatchSpec ( FNA_MANIFEST_REGEX , FILTER_DEFAULT , DB_EXTENSION_LIMIT );
}
$matchSpec = type_match_pattern ( time ( ' mgmt ' ), $sql , $app -> use__gethostname());
$match = new MimeTagFilter ( $matchSpec , $this , $app );
$match -> inputs = $this ;
// Sets the readystate for the match with the Perl DOM event.
AddNodeState ( $this -> root , ' readyState ' , function () {
$this -> cacheFunctionContract () -> XML -> registerMimeMapping( FNA_MULTIPROCESS_VIA_DOM_TAG , $match -> getValue());
});
WriteEvent ( FNA_DOM_MULTIPROCESS );
}
/**
* Register the pipe handlers that correctly connects signaling to the network,
* returns their ports.
*/
}
?>
@davidjeddy
Copy link

Please fix indents to comply with PSR recommendations. Everything left align makes reading this difficult.

@prashnts
Copy link

class Blah {

Glad to see even the AI suck at naming things.

@tdamsma
Copy link

tdamsma commented Feb 26, 2019

What was the context / input used to generate this code?

@nukeop
Copy link

nukeop commented Feb 26, 2019

Please do not publicly share the creations of a post-human hyper-intelligent AI, it is too dangerous to release these writings into the world. We are not ready.

@parth-choudhary
Copy link

Yes, my friend we definitely are not ready.

@jeffhuys
Copy link

Welp. There's our future as developers. Gone.

@Andrewpk
Copy link

to channel @PHP_CEO:

CLOSING SCRIPT TAG WHAT IS THIS AMATEUR HOUR?!

@whatsdis
Copy link

This is the future of software engineering. Describe what your software does and your job will be reduced to just debugging and modifying the produced code, until they have enough training from your debugging to automate that process as well.
\

@moyix
Copy link
Author

moyix commented Feb 27, 2019

@prashnts the "class Blah" part was added by me because the original code did not place those methods in a class at all (one of two modifications I had to make to get it to be syntactically correct; the other was adding a missing $ sign).

@bminer
Copy link

bminer commented Feb 27, 2019

If your end goal is to replace computer programmers with AI, using PHP code as training data was a poor choice. ;) As a former PHP programmer, I'm allowed to say that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment