This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime as dt | |
class Record: | |
def __init__(self, amount, comment, date=''): | |
self.amount = amount | |
# подобное присваивание читается сложнее, чем аналогичное с использованием конструкции вида | |
# if (...): | |
# self.date = | |
# else : |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static boolean canMove(final String chessPiece, | |
final String currentLocationStr, | |
final String targetLocationStr) { | |
class Position { | |
private int x; | |
private int y; | |
public Position(String position) { | |
this.x = Character.toUpperCase(position.charAt(0)) - 'A'; | |
this.y = position.charAt(1) - '1'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class IteratorWrapper implements Iterator<String> { | |
private Iterator<?> i1; | |
private Iterator<?> i2; | |
private String value; | |
IteratorWrapper(Iterator<?> iterator) { | |
this.i1 = iterator; | |
this.i2 = Collections.emptyIterator(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static class CustomStackImpl<T extends Comparable<? extends T>> { | |
private final Node<T> EMPTY = new Node<>(null, null, null, -1); | |
private int counter = 0; | |
private Node<T> head = EMPTY; | |
private final TreeMap<T, SortedSet<Node<T>>> orderedMap = new TreeMap<>(); | |
public T push(T x) { | |
int index = counter++; | |
head = head.add(x, index); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angleMode = "radians"; | |
var Boulder = function(m, x, y) { | |
this.position = new PVector(x, y); | |
this.mass = m; | |
this.width = this.mass * 10; | |
this.angle = 0; | |
this.aVelocity = 0; | |
this.aAcceleration = 0; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var G = 1; | |
var Mover = function(m, x, y) { | |
this.mass = m; | |
this.position = new PVector(x, y); | |
this.velocity = new PVector(0, 0); | |
this.acceleration = new PVector(0, 0); | |
}; | |
Mover.prototype.applyForce = function(force) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Adapted from Dan Shiffman, natureofcode.com | |
// Attractor: An object type for a draggable attractive body in our world | |
var Attractor = function() { | |
this.position = new PVector(width/2, height/2); | |
this.mass = 20; | |
this.G = 1; | |
this.dragOffset = new PVector(0, 0); | |
this.dragging = false; | |
this.rollover = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#this example uses processing.js library | |
var maxDir = new PVector(width,height); | |
var maxMag = maxDir.mag(); | |
var Mover = function() { | |
this.position = new PVector(width/2, height/2); | |
this.velocity = new PVector(0, 0); | |
this.acceleration = new PVector(0, 0); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ru.izebit; | |
import org.I0Itec.zkclient.ZkClient; | |
import org.apache.zookeeper.server.NIOServerCnxnFactory; | |
import org.apache.zookeeper.server.ServerCnxnFactory; | |
import org.apache.zookeeper.server.ZooKeeperServer; | |
import java.io.File; | |
import java.net.InetSocketAddress; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ru.izebit; | |
import org.apache.bcel.Const; | |
import org.apache.bcel.generic.*; | |
import java.io.FileOutputStream; | |
/** | |
* @author <a href="izebit@gmail.com">Artem Konovalov</a> <br/> | |
* Date: 27/04/2018/. |
NewerOlder