Skip to content

Instantly share code, notes, and snippets.

View SharpMan's full-sized avatar
🚩
Layer 8

Ismail K SharpMan

🚩
Layer 8
View GitHub Profile
public static <T> Comparator<T> Compose(
final Comparator<? super T> primary,
final Comparator<? super T> secondary
) {
return (T a, T b) -> {
int result = primary.compare(a, b);
return result == 0 ? secondary.compare(a, b) : result;
};
}
@SharpMan
SharpMan / java
Created July 21, 2015 19:19
Portal Cells Linker
package kohana.game.entities.maps.pathfinding;
import java.awt.Point;
import java.util.Arrays;
import org.apache.commons.lang3.ArrayUtils;
/**
*
* @author MelanchoŁia MØ
*/
if (isset($_POST['login']) AND isset($_POST['password']) AND !empty($_POST['login']) AND !empty($_POST['password'])) {
if ($loginArray = Application::$cache->get('login')){
var_dump($loginArray);
if(array_key_exists($_SERVER['REMOTE_ADDR'], $loginArray)){
if($loginArray[$_SERVER['REMOTE_ADDR']]["nb"] >= 7){
$timeLeft = (time () - $loginArray[$_SERVER['REMOTE_ADDR']]["lastTime"]) /60;
if($timeLeft >= 5) {
$loginArray[$_SERVER['REMOTE_ADDR']]["nb"] = 0;
User::login();
}