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 main | |
import ( | |
"fmt" | |
"net/http" | |
"runtime" | |
"strconv" | |
"strings" | |
"time" | |
) |
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
syntax = "proto3"; | |
option java_package = "com.example.todo"; | |
service TodoService { | |
rpc list (TodoListRequest) returns (TodoListReply); | |
rpc get (TodoRequest) returns (TodoReply); | |
rpc create (TodoCreateRequest) returns (TodoCreateReply); | |
rpc update (TodoUpdateRequest) returns (TodoUpdateReply); | |
rpc done (TodoDoneRequest) returns (TodoDoneReply); |
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 | |
class Sample | |
{ | |
private $fp; | |
public function __construct($local_filepath) | |
{ | |
$this->fp = fopen($local_filepath, 'w'); | |
if ($this->fp === false) { | |
throw new \Exception(__METHOD__ . " filepath: $local_filepath への書き込みに失敗しました"); |
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 | |
// snippet | |
// N+1 | |
private function bulkFetch($ids) | |
{ | |
$in = array_fill(0, count($ids), '?'); | |
$sth = $this->dbh->prepare('SELECT * FROM `users` WHERE `id` in (' . implode(',', $in) . ')'); | |
$r = $sth->execute($ids); |
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 | |
use DB; | |
use Illuminate\Console\Command; | |
class RefreshUnitTestDB extends Command | |
{ | |
protected $signature = 'test:refresh-unit-test-db'; | |
protected $description = 'Refresh local sqlitedb for API test'; |
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
{ | |
"swagger": "2.0", | |
"info": { | |
"title": "ReFUEL4 API", | |
"version": "0.0.1" | |
}, | |
"paths": { | |
"/advertisers/{advertiserId}/adsets": { | |
"get": { | |
"summary": "get Facebook AdSet list", |
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 lang="jp"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>comment</title> | |
<style type="text/css"> | |
* { | |
margin:0; | |
padding: 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
namespace :rsync do | |
# stage is reseting til remote origin | |
after :stage, :foobar do | |
system "cd #{fetch(:rsync_src)} && touch foobar" | |
end | |
end |
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 | |
$context = stream_context_create([ | |
'http' => ['header' => 'Accept-Encoding: gzip'], | |
]); | |
$fp = fopen($outputUrl, 'rb', false, $context); | |
$prediction = gzdecode(stream_get_contents($fp)); | |
fclose($fp); |
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.ini | |
xdebugの設定サンプル | |
[xdebug] | |
xdebug.remote_enable=1 | |
xdebug.overload_var_dump=1 | |
xdebug.var_display_max_data=1024 | |
xdebug.var_display_max_depth=5 | |
xdebug.remote_enable=1 | |
xdebug.remote_host=localhost |