Skip to content

Instantly share code, notes, and snippets.

View SOF3's full-sized avatar

Jonathan Chan Kwan Yin SOF3

View GitHub Profile
<?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);
@SOF3
SOF3 / world edit proposal.md
Last active January 7, 2025 19:20
Project Proposal for a world edit plugin

Project Proposal for a World Edit Plugin

This proposal describes a world edit plugin largely based on WorldEditArt's originally-intended features, along with some new ideas.

Plugin Name

This plugin will inherit the development of the WorldEditArt project and bring it to the Epsilon phase (WorldEditArt Epsilon).

About Social Stuff

Owner and Developers

This plugin be continued in the LegendOfMCPE/WorldEditArt repository.

@SOF3
SOF3 / README.md
Last active August 26, 2017 16:23

This is a simple CLI tool for managing phar files easily.

This tool is intended for Windows users using Linux-like shells.

Required executables/commands in the %PATH%:

  • mintty for starting a window that hosts the vim editor
  • vi for editing a temp file from phar v

If php is in the %PATH%, you may put this file in a directory in the %PATH% with or without a file extension, then execute this directly from the shell. For example, I save this as phar in one of the directories in my path variable, so I just execute phar l path/to/file.phar directly on Git Bash.

Poggit Crawling Notice

As mentioned in the GitHub application description, we will not use your GitHub authorization to Poggit for purposes other than those shown in the Poggit public source code. If we have to, we will inform you before doing so.

This notice informs that we are going to use your authorization to automatically inspect current repos integrated with Poggit.

What do I need to do?

You don't need to do anything. This operation is purely automated using your last login into Poggit with GitHub.

What will happen to my account?

Vaguely speaking, nothing will happen. We are trying to read the Poggit configuration in your repo and determine if there are still users using Poggit with an old configuration format and whether we can safely deprecate the old format.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<?php
namespace{
function _isset(array $a){
isset($a);
}
function _isset_index(array $a){
isset($a[0]);
}
function _empty(array $a){
empty($a);
<?php
declare(strict_types=1);
/**
* @name subEventTest
* @version 0.2.0
* @author SOFe
* @api 3.0.0-ALPHA10
* @main SOFe\Test\NewEvents\Main
@SOF3
SOF3 / YieldTask.php
Last active May 17, 2023 23:30
Proof of concept for abusing yield as sleep
<?php
namespace SOFe\YieldTask;
use pocketmine\plugin\Plugin;
use pocketmine\scheduler\PluginTask;
class YieldTask extends PluginTask{
const UNIT_TICKS = 1;
const UNIT_SECONDS = 20;
const UNIT_MINUTES = 1200;
private $generator;
private $factor;