Skip to content

Instantly share code, notes, and snippets.

View polidog's full-sized avatar
🌎

Ryota Mochizuki polidog

🌎
View GitHub Profile
<?php
class FurusatoTax
{
private int $donationPrice;
private float $incomeTaxRate;
/**
* FurusatoTax constructor.
* @param int $donationPrice
@polidog
polidog / helper.ts
Last active November 17, 2020 03:04
firestoreをfunctionsで使う時のあれ
import admin from 'firebase-admin'
const db = admin.firestore()
export type Document<T> = {
readonly id: string
readonly ref: admin.firestore.DocumentReference<admin.firestore.DocumentData>
readonly exists: boolean
data: () => T
}
@polidog
polidog / user.ts
Last active November 16, 2020 12:53
Roleによって動的にメソッドを付け替える
interface UserData {
firstName: string
lastName: string
role: 'user' | 'admin'
age: number
}
interface UserMethods {
name: () => string
}
<?php
// webpack encore
task('encore', function () {
run('cd {{release_path}} && yarn install && yarn run build');
});
before('deploy:symlink', 'encore');
@polidog
polidog / deploy.php
Last active January 22, 2018 09:52
Deployer with symfony4
<?php
namespace Deployer;
require 'recipe/symfony3.php';
// Project name
set('application', 'sf4-todo');
// Project repository
set('repository', 'git@github.com:polidog/sf4-todo.git');
@polidog
polidog / test.php
Last active December 14, 2017 17:23
privateなプロパティにアクセスできるのか!!!
<?php
class Category
{
private $id;
public function __construct($id)
{
$this->id = $id;
}
@polidog
polidog / main.go
Last active September 1, 2017 14:18
interface+pointer sample
package main
import (
"fmt"
)
type Hoge interface {
Flush()
}
@polidog
polidog / main.go
Created June 19, 2017 08:04
gin+fcgiはこんな感じでいいの?
package main
import (
"github.com/gin-gonic/gin"
"net"
"net/http/fcgi"
)
func main() {
r := gin.Default()
@polidog
polidog / hogehoge.js
Created June 17, 2017 15:57
このコードが理解できない・・・
var empty = () => {
return (pattern) => {
return pattern.empty()
}
}
var cons = (value, list) => {
return (pattern) => {
return pattern.cons(value,list)
}
@polidog
polidog / symfony.fish
Created May 8, 2017 12:11
fish completion for symfony
function _symfony_console
php (find . -maxdepth 2 -mindepth 1 -name 'console' -type f | head -n 1)
end
function _symfony_get_command_list
_symfony_console --no-ansi | sed "1,/Available commands/d" | awk '/^ ?[^ ]+ / { print $1 }'
end
complete -f -c "console" -a "(_symfony_get_command_list)"