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
" vim:fdm=marker:et:fdl=0: | |
" | |
" Author: Yo-An Lin <yoanlin93 {at} gmail.com> | |
" URL: http://c9s.blogspot.com/ | |
" | |
" Font {{{ | |
" set gfn=Dejavu\ Sans\ Mono\ 9 | |
" set gfn=Andale\ Mono:h14 | |
":set guifont=Screen15,\ 7x13,font\\,with\\,commas | |
if has('gui_mac') |
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
#!/bin/bash | |
# update the base system packages | |
apt-get update && apt-get upgrade -y | |
# Update source list for cuda and python3.6 | |
cat <<ENDLIST >> /etc/apt/sources.list | |
# non-free to nvidia-cuda-toolkit | |
deb http://ftp.de.debian.org/debian stretch non-free | |
deb http://ftp.de.debian.org/debian stretch contrib |
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
<!doctype html> | |
<html> | |
<head> | |
<title>Socket.IO chat</title> | |
<style> | |
* { margin: 0; padding: 0; box-sizing: border-box; } | |
body { font: 13px Helvetica, Arial; } | |
form { background: #000; padding: 3px; position: fixed; bottom: 0; width: 100%; } | |
form input { border: 0; padding: 10px; width: 90%; margin-right: .5%; } | |
form button { width: 9%; background: rgb(130, 224, 255); border: none; padding: 10px; } |
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
<?php | |
public function migrate(Chunk $chunk, Shard $dstShard, array $schemas) | |
{ | |
$shardId = $chunk->getShardId(); | |
if ($dstShard->id === $shardId) { | |
throw new InvalidArgumentException("{$dstShard->id} == $shardId"); | |
} | |
try { |
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
<?php | |
public function testRepoFetchColumn() | |
{ | |
$this->assertResultSuccess(Book::create([ 'title' => 'Book 1' ])); | |
$this->assertResultSuccess(Book::create([ 'title' => 'Book 2' ])); | |
// create one book with duplicated title | |
$this->assertResultSuccess(Book::create([ 'title' => 'Book 2' ])); |
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
<?php | |
/** | |
* An alias for BaseRepo::loadByKeys | |
*/ | |
protected static function loadByKeys(array $args, $byKeys = null) | |
{ | |
if (static::SHARD_MAPPING_ID) { | |
return static::shards()->first(function(BaseRepo $repo, Shard $shard) use ($arg, $byKeys) { | |
return $repo->loadByKeys($args, $byKeys); |
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
|-------------------------------------------------------------------------------------------------------| | |
| Library | Insert | findPk | complex| hydrate| with | memory usage | time | | |
| --------------------------------:| ------:| ------:| ------:| ------:| ------:| ------------:| ------:| | |
| PDO | 72 | 12 | 29 | 69 | 220 | 1,689,176 | 0.41 | | |
| Maghead | 395 | 9 | 176 | 205 | 365 | 10,485,760 | 1.16 | | |
| | | | | | | | | | |
| LessQL | 366 | 70 | 377 | 364 | 363 | 10,078,872 | 1.55 | | |
| | | | | | | | | | |
| YiiM | 714 | 86 | 436 | 292 | 614 | 8,388,608 | 2.16 | | |
| YiiMWithCache | 693 | 83 | 435 | 303 |