Skip to content

Instantly share code, notes, and snippets.

@rymizuki
rymizuki / UserFindCommand.php
Last active September 27, 2019 04:40
CleanArchitecture + Flux on Console
<?php
namespace Example\Console\Command;
class UserFindCommand extends Symfony\Console\Command\Command
{
private $interactor;
public function __construct(UserFindInteractor $interactor)
{
parent::__construct();
@rymizuki
rymizuki / Test::Spy
Created May 10, 2018 15:28
PerlでSinon.jsライクにcalled_countとcalled_argsを呼び出せるなにか
package Test::Spy;
use Mouse;
use Test::Mock::Guard ();
has module => (
is => 'ro',
isa => 'ClassName',
);
has method => (
@rymizuki
rymizuki / cli.js
Last active September 1, 2016 14:43
2016-09-02.gotandajs.
'use strict'
const fs = require('fs')
const path = require('path')
const _ = require('lodash')
const protagonist = require('protagonist')
const filepath = path.join(__dirname, 'user.md')
const raw = fs.readFileSync(filepath, 'utf8')
@rymizuki
rymizuki / components_main_action-creator.js
Last active March 16, 2016 06:32
syntagme.js - 記号化されたFluxを紬ぎ、拡張するフレームワークの構想
import syntagme from 'syntagme'
import repository from 'repository/main'
export function mount () {
return syntagme.ac("MOUNT", function () {
return repository.fetch()
})
}
app.psgi
```perl
use Amon2::Lite;
post '/api/user/', sub {
my ($c, $args) = @_;
my $params = $c->req->parameters;
my $user = $c->db->select_row('SELECT * FROM `user` FROM `name` = ?', [$params->{name}]);
return $c->create_response(409) if $user;
$c->db->query('INSERT INTO `user` (`name`, `email`) VALUES (?, ?)', [$params->{name}, $params->{email}]);
@rymizuki
rymizuki / SassMeister-input-HTML.jade
Created April 15, 2015 00:17
Generated by SassMeister.com.
div.wrapper
article.contents
header.contents__header
h1.title title
div.contents__body
section.section
h3.section__title 超長い文章
div.section__body.iscroll-content
div.scroller
p ぶんしょう
@rymizuki
rymizuki / SassMeister-input-HTML.jade
Created April 15, 2015 00:01
Generated by SassMeister.com.
div.wrapper
article.contents
header.contents__header
h1.title title
div.contents__body
section
h3 超長い文章
div.iscroll-content
div.scroller
p ぶんしょう
var http = require("http");
var express = require("express");
var morgan = require("morgan");
morgan.format("orig-format", "[:date] :method :url :status :response-time ms");
app = express();
app.use(morgan("orig-format"));
app.get("/", function (req, res) {
res.send("Hello World\n");
@rymizuki
rymizuki / SassMeister-input-HTML.jade
Created September 25, 2014 06:40
Generated by SassMeister.com.
div.buttons
a.button--general sample
a.button--important sample
a.button--navigate sample
a.button--payment sample
@rymizuki
rymizuki / SassMeister-input-HTML.jade
Created August 18, 2014 04:32
Generated by SassMeister.com.
div.buttons
a.button--general sample
a.button--important sample
a.button--navigate sample
a.button--payment sample