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 | |
use Aws\Sns\SnsClient; | |
use Illuminate\Contracts\Broadcasting\Broadcaster; | |
class SnsBroadcaster implements Broadcaster | |
{ | |
/** @var SnsClient */ | |
private $sns; | |
/** @var array */ |
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
// Find all prime numbers less than n | |
fn small_primes(bound: uint) -> ~[uint] { | |
// num is considered prime as long as primes[num] is true | |
// Start with all evens besides 2 filtered out | |
let mut primes = std::vec::from_fn(bound+1, |num| num == 2 || num & 1 != 0); | |
// Start at 3 and step by 2 because we've already filtered multiples of 2 | |
for num in count(3u, 2).filter(|&num| primes[num]).take_while(|&num| num * num <= bound) { | |
// Mark prime num's multiples non-prime | |
// We can start at num^2 because smaller non-primes have already been eliminated |