Skip to content

Instantly share code, notes, and snippets.

View polidog's full-sized avatar
🌎

Ryota Mochizuki polidog

🌎
View GitHub Profile
/*
html2image 0.0.1 <http://html2canvas.hertzen.com>
Copyright (c) 2013 Ryota Mochizuki (@polidog)
Fork by
html2canvas 0.4.0 <http://html2canvas.hertzen.com>
Copyright (c) 2013 Niklas von Hertzen (@niklasvh)
Released under MIT License
*/
<?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 / gulpfile.js
Last active February 19, 2018 12:49
Gulp+PHP CS Fixer
var gulp = require('gulp');
var exec = require('child_process').exec;
gulp.task('watch',function(){
gulp.watch("./src/**/*.php").on('change',function(event){
var command = "php-cs-fixer fix " + event.path + " --config-file=" + __dirname + "/.php_cs"
exec(command);
console.log("execute command: "+command);
})
});
@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()