Skip to content

Instantly share code, notes, and snippets.

coding in TeX...

Yegor Bugayenko yegor256

coding in TeX...
View GitHub Profile
yegor256 /
Created May 2, 2016 16:44

Keybase proof

I hereby claim:

  • I am yegor256 on github.
  • I am yegor256 ( on keybase.
  • I have a public key ASDIUlRwZERl47w7DgZXmyiI5INXc0pQyfYDd3aFsLWupAo

To claim this, I am signing this object:

yegor256 /
Last active February 18, 2022 19:02
Object-oriented dependency injection
final Agent agent = new Agent.Iterative(
new Array<Agent>(
new Understands(
new QnSince(
new QnReferredTo(
new QnParametrized(
new Question.FirstOf(
View finder.php
class Code {
private Option[] options;
ctor(Option[] opts) {
this.options = opts;
public get() {
Result result = null;
for (opt in this.options) {
if (opt.matches()) {
result = opt.get();
yegor256 /
Last active August 18, 2022 17:47
* Please review the class below and suggest improvements. How would
* you refactor this class if it would be in a real-life project?
* There are many problems here, both high-level design mistakes,
* and low-level implementation bugs. We're interested to see high-level
* problems first, since they are most critical. The more mistakes
* you can spot, the better programmer you are.
yegor256 / singleton.php
Created August 25, 2013 17:48
PHP singleton
View singleton.php
class DB1 {
protected static $_db;
public static function query($sql) {
return self::_connect()->mysql_query($sql);
protected static function _connect() {
if (!isset(self::$_db))
self::$_db = mysql_connect(/*... params ...*/);
return self::$_db;
yegor256 / document.php
Last active December 21, 2015 16:39
PHP user+document
View document.php
class Document {
public $user;
public $name;
public function init($name, User $user) {
assert(strlen($name) > 5);
$this->user = $user;