Skip to content

Instantly share code, notes, and snippets.

Avatar
😀
Open for ideas

Yegor Bugayenko yegor256

😀
Open for ideas
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am yegor256 on github.
  • I am yegor256 (https://keybase.io/yegor256) on keybase.
  • I have a public key ASDIUlRwZERl47w7DgZXmyiI5INXc0pQyfYDd3aFsLWupAo

To claim this, I am signing this object:

@yegor256
yegor256 / Agents.java
Last active Feb 18, 2022
Object-oriented dependency injection
View Agents.java
final Agent agent = new Agent.Iterative(
new Array<Agent>(
new Understands(
this.github,
new QnSince(
49092213,
new QnReferredTo(
this.github.users().self().login(),
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();
View quiz.java
/**
* 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.
*/
/**
View singleton.php
<?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
yegor256 / document.php
Last active Dec 21, 2015
PHP user+document
View document.php
<?php
class Document {
public $user;
public $name;
public function init($name, User $user) {
assert(strlen($name) > 5);
$this->user = $user;