View _app.tsx
import { AppProps } from 'next/app' | |
import Head from 'next/head' | |
const App = ({ Component, pageProps }: AppProps) => ( | |
<> | |
<Head> | |
<meta | |
name="viewport" | |
content="width=device-width, initial-scale=1, shrink-to-fit=no" | |
/> |
View 0->100 arrow functions
... | |
checks | |
// no args | |
// block | |
// implicit parameter | |
// assign |
View perrin-prime-check.ts
// perrin(n) / n === 0 | |
// = | |
// isPrime(n) | |
const perrinMemo: [bigint, bigint, bigint] = [0n, 2n, 3n] | |
const primeMemo: number[] = [2, 3] | |
function perrinNext(): bigint { | |
const next = perrinMemo[0] + perrinMemo[1] | |
perrinMemo[0] = perrinMemo[1] |
View make_badge.sh
#!/bin/bash | |
# this script dependence "pup", "jq" | |
USERNAME=$1 | |
SELECTOR='tr:nth-child(2) span:nth-child(1) json{}' | |
USERDATA=$(curl -s https://atcoder.jp/users/$USERNAME |pup $SELECTOR) | |
COLOR=$(echo $USERDATA |jq --raw-output ".[0].class" |sed 's/user-//') | |
RATE=$(echo $USERDATA |jq --raw-output ".[0].text") |
View make_badge.sh
#!/bin/bash | |
# this script dependence "pup", "jq" | |
USERNAME=$1 | |
SELECTOR='tr:nth-child(2) span:nth-child(1) json{}' | |
USERDATA=$(curl -s https://atcoder.jp/users/$USERNAME |pup $SELECTOR) | |
COLOR=$(echo $USERDATA |jq --raw-output ".[0].class" |sed 's/user-//') | |
RATE=$(echo $USERDATA |jq --raw-output ".[0].text") |
View package.json
{ | |
"name": "competitive-pg-wrokspace", | |
"version": "1.0.0", | |
"main": "index.js", | |
"author": "elzup <guild0105@gmail.com>", | |
"license": "MIT", | |
"devDependencies": { | |
"@types/node": "^13.5.3", | |
"atcoder-cli": "^2.0.4", | |
"eslint": "^6.8.0", |
View day-changed.js
const nextDay = () => new Date().setHours(0, 0, 0, 0) + 24 * 60 * 60 * 1000 | |
const tommorowFromNow = () => nextDay() - new Date() | |
setTimeout(() => { | |
// code | |
}, tommorowFromNow()) |
View cdr-recent-dirs-clean.sh
#!/bin/sh | |
cat ~/.chpwd-recent-dirs \ | |
| sed -e 's/^..\(.*\)./\1/g' \ | |
| while read line | |
do | |
if [ -d "$line" ]; then | |
echo "\$'$line'" | |
fi | |
done |
View functions_index.js
import * as functions from 'firebase-functions' | |
import * as admin from 'firebase-admin' | |
admin.initializeApp({ | |
credential: admin.credential.applicationDefault(), | |
// databaseURL: 'https://hoge.firebaseio.com/', | |
}) | |
export const api = functions.https.onRequest(async (req, res) => { | |
const message = { |
View gh-pages.yml
name: GitHub Pages | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build-deploy: |
NewerOlder