Skip to content

Instantly share code, notes, and snippets.

View mpyw's full-sized avatar
🏠
Working from home

mpyw mpyw

🏠
Working from home
View GitHub Profile
@mizchi
mizchi / predict-frontend.md
Last active July 27, 2025 04:49
React のユーザーから見た今後のフロントエンドの予想

この記事は議論のたたき台で、ポジショントークや、偏見にまみれています。

今のフロントエンドの分類

  • 古典的なサーバーサイド WAF への +α の味付け
  • 大規模なクライアントアプリケーション管理のための SPA
  • SEO / SSR を考慮した Node ヘヴィーな環境

他、提唱されてるパターン

@holstvoogd
holstvoogd / prune-log-stream.sh
Created August 10, 2018 15:06
Removes empty log streams from a given log group
#!/bin/bash
loggroup=$1
dryrun=$2
if [[ -z $loggroup || $loggroup == '--dryrun' ]]; then
echo "Usage: $0 LogGroup [--dryrun]"
exit 1
fi
@qnighy
qnighy / rust-patterns.md
Last active March 6, 2025 19:03
Rustのパターンっぽいやつメモ

パターンとはその言語が抽象化できなかった敗北の歴史である。 しかしどんなに優れた言語であってもあらゆる繰り返しに勝てるわけではない。 人は必ずメタ繰り返しを欲するからだ。 そしてそれはRustも例外ではない。

ここでは、OOPでも知られているパターンよりも、Rustに特有のパターンを思いつく限りまとめてみた。名前は適当。

  • crate splitting
    • でかいcrateを分割して、見通しを良くする・再コンパイルの分量を削減する・並列コンパイルを可能にする
  • 親玉crate(全てにdependする)と殿crate(全てにdependされる)があることが多いので、だいたい束みたいな形になる。
import React from 'react';
import { TextInput as Input } from 'react-native';
export default class TextInput extends React.Component {
static defaultProps = {
onFocus: () => { },
}
constructor(props) {
super(props);
@tenpoku1000
tenpoku1000 / AC_2017-12-08.md
Last active February 21, 2025 02:07
UTF-32 でも固定長で処理出来るわけではない

UTF-32 でも固定長で処理出来るわけではない

2024/04/17 更新

この記事は、自作OS Advent Calendar 2017の 12/8 の記事として書かれました。

もう、日本語の漢字や仮名を 2 バイト文字と呼ぶのは、やめよう

IT 系のニュースサイトでも、未だに日本語の漢字や仮名のことを 2 バイト文字と呼んでいる記事が散見されます。

@aerostitch
aerostitch / aws_cleanup_cloudwatch.go
Last active April 28, 2021 17:47
Delete empty log streams or logs streams that have only elements older than 30 days in it
package main
// This script cleans up old LogGroups (empty and olde than 90 days and old
// LogStreams (last event timestamp is over 30 days old or if the logstream
// is empty and has been created over 30 days ago) from AWS Cloudwatch
import (
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/cloudwatchlogs"
"log"
@jmackie
jmackie / reader.go
Last active April 25, 2024 20:51
Pass a single io.Reader to multiple goroutines
/*
Package fan is a little concurrent io experiment.
Example Use Case
----------------
You have a function that takes a single io.Reader as an argument. You would like
to pass that reader to several processing functions. You could just make the
function accept an io.ReadSeeker, invoke each function serially in a for loop,
seeking after each call. But that's not cool.
@alexweissman
alexweissman / BelongsToManyThrough.php
Last active May 12, 2023 07:58
Custom BelongsToManyThrough relationship for Laravel/Eloquent
<?php
/**
* UserFrosting (http://www.userfrosting.com)
*
* @link https://github.com/userfrosting/UserFrosting
* @copyright Copyright (c) 2013-2017 Alexander Weissman
* @license https://github.com/userfrosting/UserFrosting/blob/master/licenses/UserFrosting.md (MIT License)
*/
namespace UserFrosting\Sprinkle\Core\Model\Relations;
@tamanobi
tamanobi / README.md
Last active February 11, 2021 13:09
dockerのlinkオプションがレガシーなので、コンテナ間で名前解決できるようにネットワークを用意する(http://qiita.com/tamanobi/items/8b8dd64ae1f959f9ff9f) の記事中で行った操作を`docker-compose`コマンドで実行できるように`docker-compose.yml`としてまとめた。

概要

dockerのlinkオプションがレガシーなので、コンテナ間で名前解決できるようにネットワークを用意する の記事中で行った操作をdocker-composeコマンドで実行できるようにdocker-compose.ymlとしてまとめた。

使用方法

$ cd my_workspace
$ mkdir ./nginx/conf.d
$ mkdir ./app
$ wget https://gist.githubusercontent.com/tamanobi/cfef34197d531945872173fcb0906cf5/raw/9201d1df12244c94b73d29ec3b4c9ffb0bc68663/php.conf -P ./nginx/conf.d
$ wget https://gist.githubusercontent.com/tamanobi/cfef34197d531945872173fcb0906cf5/raw/9201d1df12244c94b73d29ec3b4c9ffb0bc68663/app.php -P ./app
@tomatau
tomatau / App.js
Last active December 2, 2017 21:19
SSR React Router Redux Suggestion
import { Switch, Route } from 'react-router'
import { replace } from 'react-router-redux'
@connect(null, { replace })
class PrivateRoute extends React.Component {
componentWillMount() {
this.props.replace('/foo')
}
render() {