This was taken from http://rxwiki.wikidot.com/101samples, because I wanted to be able to read it more comfortable with syntax highlighting.
Here's the unedited original, translated to Github Markdown glory:
| using { /Verse.org/Random } | |
| Array<public> := module: | |
| # Makes an `array` with only unique elements | |
| (Input:[]t where t:subtype(comparable)).Unique<public>()<transacts>:[]t = | |
| var UniqueArray : []t = array{} | |
| for (Value : Input): | |
| if (UniqueArray.Find[Value] > -1) {} | |
| else: |
| <?php | |
| namespace App\Http\Middleware; | |
| use Closure; | |
| use Illuminate\Support\Arr; | |
| class RobotEntertainerMiddleware | |
| { | |
| const prohibitedRoutes = [ |
| function adb_connect { | |
| # PORT used to connect. Default: 5555 | |
| PORT=${1:-5555} | |
| # IP address from current device connected | |
| IP_ADDRESS=`adb shell ip route | awk '{print $9}'` | |
| echo "ADB connect to $IP_ADDRESS on port $PORT" | |
| # Change connection from usb to tcpip using $PORT |
| // Warning: Keep in mind that this example has a lot of boilerplate, | |
| // because I want to make sure it's as easy to grasp as possible. | |
| // In a real application you would probably want to wrap the cooldown | |
| // check in a higher order function that easily creates a command and | |
| // checks the cooldowns for you. | |
| // The cooldown manager example | |
| var CooldownManager = { | |
| cooldownTime: 30000, // 30 seconds | |
| store: { |
This was taken from http://rxwiki.wikidot.com/101samples, because I wanted to be able to read it more comfortable with syntax highlighting.
Here's the unedited original, translated to Github Markdown glory:
| # Backup | |
| docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
| # Restore | |
| cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |