Skip to content

Instantly share code, notes, and snippets.

View markuplint-error-for-compilation-mode.awk
#! /usr/bin/awk -f
BEGIN {
filename = ""
}
/<markuplint> ([^:])+: (.)/ { # filename
sub(/\:$/, "", $2)
if ($3 == "") {
filename = ""
View jekyll-and-jekyll-vite-cache-dir-mismatch.md
@wtnabe
wtnabe / limit-eslint-target-version-to-es2017.sh
Last active Dec 8, 2021
ESLintの設定でうっかり新しい記法が許されていた場合に警告する
View limit-eslint-target-version-to-es2017.sh
#! /bin/sh
target_version=2017
main () {
config_file=$1
if [ -z "$config_version" ]; then
cat <<EOD
eslint config file not specified
@wtnabe
wtnabe / postcss.config.js
Last active Jan 24, 2022
PostCSSからSass ( Scss ) を使う設定
View postcss.config.js
module.exports = () => {
const plugins = [
// Sass独自の _ スコア始まりのファイル名や glob 対応
require('postcss-easy-import')({
extensions: ['.css', '.scss'],
prefix: '_'
}),
// Sass独自の `//' コメントを削除
require('postcss-strip-inline-comments'),
// Sassのコンパイル
@wtnabe
wtnabe / gist:60706694f292432dd0872f3ac3309d65
Last active Sep 14, 2021
HTMLページ読み込み時のwindowとdocumentのeventの並び
View gist:60706694f292432dd0872f3ac3309d65
document.readyState: interactive
Stimulus.Controller: connect
document: DOMContentLoaded
document.readyState: complete
window: load
window: pageshow
@wtnabe
wtnabe / page-lifecycle.html
Created Apr 29, 2021
戻るとかでページを離脱する際の event を捕捉できるか、実験
View page-lifecycle.html
<html>
<head>
<meta name="viewport" content="width=device-width">
</head>
<body>
<script type="text/javascript" src="https://unpkg.com/page-lifecycle@0.1.2/dist/lifecycle.es5.js"></script>
<script type="text/javascript">
lifecycle.addEventListener('statechange', (event) => {
console.log('statchange')
console.log(event)
@wtnabe
wtnabe / README.md
Created Mar 7, 2021
PostgreSQL 12のcollationの動作確認。columnかorder byにcollateを付与して利用する。アルファベットの大文字小文字の順番はcreate collateするしかなさそう。
View README.md

PostgreSQL 12 collation behavior verification

Procedure

  1. git clone
  2. mkdir pgdata
  3. docker-compose run -e POSTGRES_PASSWORD=password postgres
  4. docker-compose up
  5. psql -h localhost -U postgres -f ./create_database.sql
  6. psql -h localhost -U postgres -f ./create_table.sql collation_practice
@wtnabe
wtnabe / stimulus-and-mobx-counter.html
Last active Feb 3, 2022
Stimulus 2 and MobX 6 Counter example
View stimulus-and-mobx-counter.html
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<script src="https://cdn.jsdelivr.net/npm/stimulus@2.0.0/dist/stimulus.umd.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/mobx@6.1.7/dist/mobx.umd.development.js"></script>
<script>
mobx.configure({
enforceActions: "always"
})
View javascript-proxy-example.ts
export class FooModel extends Function {
private repos: any
/**
* @param {object} repos
* @return {Proxy}
*/
constructor (repos: any = createRepository('foo')) {
super()
this.repos = repos
View nestjs-console.ts
import { NestFactory } from '@nestjs/core'
import { AppModule } from './app.module'
const repl = require('repl')
async function bootstrap () {
const app = await NestFactory.createApplicationContext(AppModule)
console.log('starting repl ...')
repl.start().context.app = app
}