Skip to content

Instantly share code, notes, and snippets.

Max Ovsiankin maxov

Block or report user

Report or block maxov

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am maxov on github.
  • I am maxov (https://keybase.io/maxov) on keybase.
  • I have a public key ASDOdy2BWYhJfJHXWVLoI_D_QKt4xKMqaa__h-5g-HIKlgo

To claim this, I am signing this object:

View Test.py
def x():
return 3
print(x())
@maxov
maxov / README.md
Last active Jan 1, 2016
Monads in LiveScript
View README.md

This is an implementation of monads in a way that is pretty for LiveScript(given its amazing syntactic structures). This was originally a comment for LiveScript #426.

@maxov
maxov / 0_reuse_code.js
Last active Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View subdivide.py
from collections import namedtuple
from string import lowercase
Rect = namedtuple('Rect', ['name', 'weight'])
# finds the sum of a list of rects
def rects_sum(rects):
return sum(rect.weight for rect in rects)
# finds the difference between the minimum aspect ratio of rectangles in the subdivison and a perfect square
@maxov
maxov / text-formatting.md
Last active Aug 29, 2015
A description of text formatting
View text-formatting.md

Text Formatting

What are the goals?

  • A format that is easy for server admins to configure
  • A format that is familiar to people dealing with text/easy to learn
  • A format that is extensible and has the power to configure text objects in any way possible

Variables

View data-merge.md

Data Merging

Data merging is the process by which new data as set by a plugin is put back into someplace where it carries more meaning, like an entity or block.

The current method

The Sponge API has had DataPriority for a while. It essentially dictates how data from a copier and copiee (?) should be merged, applying specifically to the case of filling data in a mainpulator or offering it back to the containing holder.

View cond.lisp
; the let macro
(set macros "let" (fn (tree)
(if (== (len tree) 0)
(err "let takes at least one arg")
(let
(expr (last tree))
(body (map (init tree) (fn (tree)
(cons (quote "def") tree))))
(form (push (cons (quote "do") body) expr))
(compileExpr form body)))))
View value-api-question.java
// current data api
Optional<DisplayNameData> wrappedDisplayName = entity.getData(DisplayNameData.class);
if (wrappedDisplayName.isPresent()) {
DisplayNameData displayname = wrappedDisplayName.get();
displayname.setDisplayName(Texts.of(displayName.get(), "hai!"));
entity.offer(displayname);
}
// value api
if (entity.supports(Values.DISPLAY_NAME)) {
View value-api.java
// data api
Optional<DisplayNameData> wrappedDisplayName = entity.getData(DisplayNameData.class);
if (wrappedDisplayName.isPresent()) {
DisplayNameData displayname = wrappedDisplayName.get();
displayname.setDisplayName(Texts.of(displayName.get(), "hai!"));
entity.offer(displayname);
}
// equivalent POJO
if (entity.displayName != null) {
You can’t perform that action at this time.