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 | |
/** | |
* A class which contains a private list of gaming consoles. | |
* Can be looped as the class implements IteratorAggregate | |
* | |
* Class ConsoleCollection | |
*/ | |
class ConsoleCollection implements \IteratorAggregate | |
{ |
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 | |
function exceptionThrower() | |
{ | |
try { | |
throw new \Exception('Bang!'); | |
} catch(\Exception $e) { | |
echo 'An exception happened but I caught it!' . PHP_EOL; | |
return 5; | |
} finally { |
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 | |
/** | |
* @author James Mannion <[email protected]> | |
* @link https://www.jamse.net | |
*/ | |
/** | |
* Interface CarInterface | |
*/ | |
interface CarInterface | |
{ |
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 | |
/** ...Make the request, decode the response */ | |
$validator->validate($decodedResponse, json_decode('details.json')); | |
if (!empty($validator->getErrors())) { | |
throw new InvalidResponseException( | |
sprintf('Invalid Net Verify response for [%s]: [%s]', $type, implode(',', $errorMessages)) | |
); |
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 | |
/** ...Make the request, decode the response */ | |
/** Check scan reference is present before we can use it */ | |
if (!isset($decodedResponse->scanReference)) { | |
throw new \Exception("Invalid response - Scan Reference is missing"); | |
} | |
if (!is_string($decodedResponse->scanReference)) { |
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
package main | |
import ( | |
"fmt" | |
"log" | |
"github.com/aws/aws-sdk-go/aws" | |
"github.com/aws/aws-sdk-go/aws/session" | |
"github.com/aws/aws-sdk-go/service/sqs" | |
) |
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
package main | |
import ( | |
"fmt" | |
"runtime" | |
"sync" | |
) | |
func main() { | |
var counter int |
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
package main | |
import ( | |
"fmt" | |
) | |
func main() { | |
q := make(chan bool) | |
c := gen(q) | |
receive(c, q) |
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
package main | |
import ( | |
"fmt" | |
"time" | |
"sync" | |
) | |
func main() { |
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
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
func main() { | |
slowChan := make(chan string) |
OlderNewer