Skip to content

Instantly share code, notes, and snippets.

View TikiCat7's full-sized avatar

Wataru Ikeda TikiCat7

  • Singapore / Tokyo
View GitHub Profile
@tak-dcxi
tak-dcxi / typography.md
Last active January 21, 2026 07:55
タイポグラフィCSS

タイポグラフィ

font-family

  • フォントは Web サイトの印象に直結するため、一概にこれが良いとは言えない。
  • 特にこれと言った指定がされていない場合は font-family: sans-serif のみで良い。
    • Windows 11/10 では 2025 年のアップデートにより Noto Sans JP が標準搭載された。色々と問題があった游ゴシックの呪縛から解放されたのは大きい。
    • Android はメーカーにより削除されている可能性はあるが、そうでない場合は原則的に Noto Sans CJK JP が適用される。
    • Mac/iOS はヒラギノ角ゴ ProN が適用される。
  • アップデートによるフォントの変更の懸念はあるものの、ディスクリシアの方々は UD デジタル教科書体などの読みやすいフォントを設定している可能性があるため、アクセシビリティの観点では font-family: sans-serif の指定を推奨する。
@clintonmedbery
clintonmedbery / isMount.js
Last active February 4, 2020 05:37
Useful Hooks
//Hook used to determine if it is a component's first mount
//Useful to put in useEffect functions that share data calls but not all the same calls
import { useRef, useEffect } from 'react'
//https://stackoverflow.com/a/56267719/3058839
export const useIsMount = () => {
const isMountRef = useRef(true)
useEffect(() => {
isMountRef.current = false
@wcandillon
wcandillon / rn-init.sh
Last active March 12, 2020 14:46
Bootstrapping a React Native Project in 2019
expo init $1
cd $1
yarn add @types/expo eslint eslint-config-react-native-wcandillon --dev
mv App.js App.tsx
curl -O https://gist.githubusercontent.com/wcandillon/10f40b913f1c63f357169b97473f9eb2/raw/45c677856ae512cbb8db41308de72d149fded5b4/tsconfig.json
curl -O https://gist.githubusercontent.com/wcandillon/f734fb532bffec0abc436749dd46c4bf/raw/c33de2df4b4fb4dec0b6f44e6aa1ceb5d7004141/.eslintrc
@fokusferit
fokusferit / enzyme_render_diffs.md
Last active November 5, 2025 09:57
Difference between Shallow, Mount and render of Enzyme

Shallow

Real unit test (isolation, no children render)

Simple shallow

Calls:

  • constructor
  • render
@wesbos
wesbos / async-await.js
Created February 22, 2017 14:02
Simple Async/Await Example
// 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works
const axios = require('axios'); // promised based requests - like fetch()
function getCoffee() {
return new Promise(resolve => {
setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee
});
}
@acdlite
acdlite / app.js
Last active July 22, 2025 08:36
Quick and dirty code splitting with React Router v4
// getComponent is a function that returns a promise for a component
// It will not be called until the first mount
function asyncComponent(getComponent) {
return class AsyncComponent extends React.Component {
static Component = null;
state = { Component: AsyncComponent.Component };
componentWillMount() {
if (!this.state.Component) {
getComponent().then(Component => {
@david-casagrande
david-casagrande / react-enzyme-async-tdd.js
Last active July 29, 2016 07:38
react/enzyme/async tdd
// non-async
it('Correctly makes AJAX request in `componentDidMount`', () => {
nock('https://api.github.com')
.get('/users')
.reply(200, [
{ 'name': 'Reign', 'age': 26 }
]);
wrapper = mount(<UsersListComponent />);
@learncodeacademy
learncodeacademy / webpack.config.js
Created January 8, 2016 03:55
Sample Basic Webpack Config
var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');
module.exports = {
context: __dirname,
devtool: debug ? "inline-sourcemap" : null,
entry: "./js/scripts.js",
output: {
path: __dirname + "/js",
filename: "scripts.min.js"
@karpathy
karpathy / min-char-rnn.py
Last active January 18, 2026 04:55
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)