Skip to content

Instantly share code, notes, and snippets.

Koutaro Chikuba mizchi

Block or report user

Report or block mizchi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View searchPath.test.ts
import assert from "assert";
import searchPath, { Point } from "./searchPath.ts";
import range from "lodash/range";
type Hitmap = {
sizeX: number;
sizeY: number;
map: number[];
};
View Dockerfile-node
FROM node:alpine
RUN apk add --no-cache tini yarn
WORKDIR /app
ENTRYPOINT ["/sbin/tini", "--"]
COPY ./package.json ./yarn.lock ./
RUN yarn install
COPY ./ .
View css-pixel-art-pattern.css
// for https://cssbattle.dev/play/2
:root {
--size: 50px;
}
body {background: #62374e;}
body::before {
content: "";
width: var(--size);
View lib.rs
use wasm_bindgen::prelude::*;
use wasm_bindgen::JsCast;
fn run() -> Result<(), JsValue> {
let document = web_sys::window().unwrap().document().unwrap();
let canvas = document
.create_element("canvas")
.unwrap()
.unchecked_into::<web_sys::HtmlCanvasElement>();
canvas.set_attribute("width", "400px")?;
View auth0-login.tsx
// Ref https://github.com/auth0-samples/auth0-react-samples/blob/master/01-Login
import auth0 from "auth0-js";
import React, { useEffect, useState, useContext } from "react";
import ReactDOM from "react-dom";
import {
BrowserRouter,
Switch,
Route,
RouteComponentProps,
// @ts-ignore
@mizchi
mizchi / client.tsx
Created Apr 4, 2019
auth-by-jwt example
View client.tsx
import "@babel/polyfill";
import axios from "axios";
import { render, h, Fragment } from "preact";
import { useState, useEffect } from "preact/hooks";
import { ulid } from "ulid";
const AUTH_TOKEN_KEY = ":token";
const CURRENT_NAME = ulid();
View canvas-in-websys.rs
// https://rustwasm.github.io/wasm-bindgen/examples/2d-canvas.html
use wasm_bindgen::prelude::*;
use wasm_bindgen::JsCast;
#[wasm_bindgen(start)]
pub fn start() {
web_sys::console::log_1(&"start".into());
let document = web_sys::window().unwrap().document().unwrap();
let canvas = document.create_element("canvas").unwrap();
View webpack.config.js
const path = require("path");
const CleanWebpackPlugin = require("clean-webpack-plugin");
const TerserPlugin = require("terser-webpack-plugin");
module.exports = {
entry: {
"main": "src/index"
},
output: {
View main.tsx
import React, { Suspense } from "react";
import ReactDOMServer from "react-dom/server";
import { renderRoutes, matchRoutes, MatchedRoute } from "react-router-config";
import { StaticRouter } from "react-router-dom";
import ShallowRenderer from "react-test-renderer/shallow";
import { renderAsync, createResource } from "./renderAsync";
const shallowRenderer = ShallowRenderer.createRenderer();
// data fetcher
View docker-compose.yml
version: '3.3'
services:
mysql:
image: mysql:5.7
command: --default-authentication-plugin=mysql_native_password
restart: always
ports:
- '3306:3306'
environment:
MYSQL_ROOT_USER: root
You can’t perform that action at this time.