This file contains hidden or 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 | |
import java.time.LocalDateTime; | |
import java.util.*; | |
import java.util.function.Function; | |
import java.util.function.Supplier; | |
public class InMemoryTable<K, V> { | |
private final Map<K, List<Record<K, V>>> map = new HashMap<>(); | |
private final Supplier<LocalDateTime> localDateTimeSupplier; |
This file contains hidden or 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 javaslang.Tuple; | |
import javaslang.Tuple2; | |
import javaslang.control.Option; | |
import java.time.LocalDateTime; | |
import javaslang.collection.LinkedHashMap; | |
public class Cache<K, V> { | |
private LinkedHashMap<K, Tuple2<V, LocalDateTime>> linkedHashMap = LinkedHashMap.empty(); | |
private final int maxCount; |
This file contains hidden or 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
php -S 0.0.0.0:8080 -t src |
This file contains hidden or 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
#!/usr/bin/env python | |
import commands | |
import json | |
def pycurl(cmd): | |
c = "curl -s " + cmd | |
result = commands.getoutput(c) | |
return json.loads(result) |
This file contains hidden or 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 sys | |
i = 0 | |
for line in sys.stdin: | |
print "{0}:{1}".format(i, line.strip()) | |
i = i + 1 |
This file contains hidden or 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
<?php | |
interface DateTimeFactory { | |
public function createDateTime(): DateTime; | |
public function createUnixDateTime(): int; | |
} | |
class DateTimeFactoryImpl implements DateTimeFactory { | |
public function createDateTime(): DateTime { | |
return new DateTime(); | |
} |
This file contains hidden or 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
<?php | |
function includeFromWeb($url, $root = '.') { | |
$file = $root . '/vendor/' . explode('//', $url)[1]; | |
$dir = substr($file, 0, strrpos($file, '/')); | |
if(!file_exists($file)) { | |
if(!file_exists($dir)) { | |
mkdir($dir, 0777, true); | |
} | |
$text = trim(file_get_contents($url)); |
This file contains hidden or 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
<?php | |
class EasyInclude { | |
private $root; | |
private $excludePhp; | |
public function __construct($root, $excludePhp = null) { | |
$this->root = $root; | |
$this->excludePhp = $excludePhp; | |
} | |
private function loadFromWeb($url) { |
This file contains hidden or 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 com.naosim.table; | |
import java.util.HashMap; | |
import java.util.Map; | |
public class Table<ROW, CLM, CELL> { | |
private final Map<CLM, Integer> columnIndex; | |
private final Map<ROW, CELL[]> rows; | |
public Table(CLM ...columns) { |
This file contains hidden or 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 com.naosim.table; | |
import java.util.HashMap; | |
import java.util.Map; | |
public class VariousColumnTable<ROW> { | |
private final Map<Class, Integer> columnIndex; | |
private final Map<ROW, Object[]> rows; | |
public VariousColumnTable(Class ...columns) { |