Skip to content

Instantly share code, notes, and snippets.

View SOF3's full-sized avatar
🚂
Watching the model train

Jonathan Chan Kwan Yin SOF3

🚂
Watching the model train
View GitHub Profile
RewriteRule "^/([A-Za-z0-9]([A-Za-z0-9\-]*[A-Za-z0-9\-])?)/([A-Za-z0-9_\-]+)(/([^\.]+))?\.(zip|tar|gz|phar|php|pmf)" /index.php?username=$1&repo=$3&version=$5&extension=$6

For 4 people:

1,2;3,4
1,3;2,4
1,4;2,3

For 6 people:

1,2;3,4;5,6

1,3;2,5;4,6

<?php
class ReadStreamTask extends AsyncTask{
public function __construct(string $host, CommandSender $sender){ // Step 1
$this->host = $host;
parent::__construct($sender);
}
public function onRun(){
$socket = fsockopen($this->host); // Step 2
@SOF3
SOF3 / plugin.yml
Created November 12, 2016 14:42 — forked from PEMapModder/plugin.yml
ChatPopSound - Auto-generated gist plugin stub by pmt.mcpe.me InstaPlugin
---
name: ChatPopSound
author: PEMapModder
version: "1.0"
api:
- 1.12.0
main: PEMapModder\ChatPopSound\Main
commands: []
permissions: []
...
6
7
8
9
10
11
12
13
14
15
<?php
class SendMessageTask extends AsyncTask{
public function __construct(PluginMain $mainClass, string $url){
parent::__construct($mainClass);
$this->url = $url;
}
public function onRun(){
$this->setResult(Utils::getURL($this->data));
}
<?php
class MigrateDatabaseTask extends AsyncTask{
public function __construct(MigrateProgress $progress){
parent::__construct($progress);
}
public function onRun(){
$input = new InputDataIterator();
$output = new OutputWriter();
foreach($input as $datum){
@SOF3
SOF3 / OrgManager.md
Last active February 25, 2017 13:45

OrgManager

This document explains the mechanism in OrgManager.

This plugin aims to provide an API that generalizes the organization mechanism in organization-based plugins, such as plugins for factions, plugins for teams, plugins for chat channels, etc.

Various organization types

There can be many types of organizations, as defined by plugins. While all types of organizations have the same basic mechanism, the following are same within each type but could be different between different types:

  • Type ID: Each type is identified by a type ID constant. This should be prefixed by the identifier of the plugin that declares it, e.g. orgmanager.simpleteam. The type ID must match the regex /^[a-z0-9\-](\.[a-z0-9\-])+$/.
<?php
class ReadOnlyFileStreamWrapper{
const SCHEME_RAW = "pmmpreadonly";
const SCHEME = self::SCHEME_RAW . "://";
private $realPointer;
public function stream_open($path, $mode){
assert(substr($path, 0, strlen(self::SCHEME)) === self::SCHEME);