Skip to content

Instantly share code, notes, and snippets.

View shin1x1's full-sized avatar
😀

Masashi Shinbara shin1x1

😀
View GitHub Profile
@shin1x1
shin1x1 / counter.ts
Last active November 14, 2018 09:26
console.log('counter loading...');
const counter = {
no: 0
};
export default counter;
<?php
declare(strict_types=1);
namespace Acme\Account\UseCases;
use Acme\Account\Models\Account;
use Acme\Account\Models\AccountNumber;
use Acme\Account\Models\Money;
final class TransferMoney
@shin1x1
shin1x1 / build_curl.sh
Created February 23, 2018 16:13
Build curl with openssl in CentOS/RHEL/Amazon Linux
#!/bin/sh
set -eux
VERSION=7.58.0
OUTPUT=/opt/build
rm -rf ${OUTPUT}
mkdir ${OUTPUT}
yum install -y openssl-devel gcc bzip2 make
@shin1x1
shin1x1 / file0.go
Created January 25, 2018 06:28
Echo で HTTP リクエストヘッダをミドルウェアでダンプする ref: https://qiita.com/shin1x1/items/cfe7568cecbaffe0b23c
package main
import (
"github.com/labstack/echo"
"fmt"
"log"
"os"
)
func main() {
{
"require": {
"php": ">=5.6.4",
"cakephp/chronos": "^1.1",
"goodby/csv": "^1.3",
"laravel/framework": "5.4.*",
"laravel/tinker": "~1.0",
"laravelcollective/html": "^5.4",
"rollbar/rollbar": "^1.2",
"s-ichikawa/laravel-sendgrid-driver": "^1.2"
<?php
const LOOP = 1000000;
$bench = function (string $label, callable $func) {
$s = microtime(true);
for ($i = 0 ; $i < LOOP ; $i++) {
$func(1, 2);
}
echo '=== ' . $label, PHP_EOL;
echo (microtime(true) - $s), PHP_EOL;
current -> releases/20170409123456
releases/
  20170407100000/
  20170409091001/
  20170409123456/
shared/
<?php
const HOST = '49.212.25.40';
const PORT = '80';
function createStream() {
$errorNo = $errorMessage = null;
$stream = stream_socket_client(HOST . ':' . PORT, $errorNo, $errorMessage, 10);
if (!$stream) {
throw new \Exception($errorNo . ':', $errorMessage);
}
<?php
namespace Acme;
class Foo
{
public static function hello()
{
var_dump('Hello');
}
}