Skip to content

Instantly share code, notes, and snippets.

.marquee {
@apply flex-1 flex overflow-hidden;
}
.marquee .marquee-inner {
@apply truncate flex-1;
}
.marquee.marquee-active .marquee-inner {
@apply flex-none;
@dragonman225
dragonman225 / useFunctionRef.js
Last active September 1, 2021 08:26
React.useRef for functions.
// Copyright (c) 2021 Wen-Zhi (Alexander) Wang <[email protected]>
// SPDX-License-Identifier: MIT
import { useRef } from 'react';
function assert(mayBeFunction) {
if (typeof mayBeFunction !== 'function' && mayBeFunction != null) {
console.log(mayBeFunction);
throw new Error(
'It is now allowed to pass in a thing that is not a function, ' +
# vim:ft=zsh ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
# Make sure you have a recent version: the code points that Powerline
@dragonman225
dragonman225 / crawl-course-info.js
Created January 6, 2021 09:14
Crawl course info from timetable.nctu.edu.tw. Remember to install "superagent" package from npm.
const agent = require("superagent")
var domain = "https://timetable.nctu.edu.tw/";
var searchUrl = "?r=main/get_cos_list";
var academicYear = "109";
var semester = "1";
var courseNumber = "1144";
agent
.post(domain + searchUrl)
@dragonman225
dragonman225 / .eslintrc.js
Created December 12, 2020 09:59
ESLint config for TypeScript + React
// Useful references:
// https://www.npmjs.com/package/eslint-config-react-app
// https://github.com/facebook/create-react-app/blob/master/packages/eslint-config-react-app/index.js
// https://medium.com/@dors718/linting-your-react-typescript-project-with-eslint-and-prettier-2423170c3d42
const path = require('path')
module.exports = {
root: true, // Prevent looking for config all the way up in parent directories
env: { // Enable environment-specific global variables
@dragonman225
dragonman225 / record_agqr.sh
Last active October 8, 2020 16:20
Record "超!A&G+" radio programs. rtmpdump need to be installed. Usage: sh record_agqr.sh <duration> <directory_to_save_to>
#!/bin/bash
duration=$1
cwd=$2
start_time=$(date +%G.%m.%d-%H:%M)
rtmpdump \
-r rtmp://fms-base2.mitene.ad.jp/agqr/aandg333 -v -B "${duration}" \
-o "${cwd}/agqr_${start_time}+${duration}s.flv"
@dragonman225
dragonman225 / rec_radiko.sh
Created August 29, 2020 07:59 — forked from matchy256/rec_radiko.sh
簡易Radiko録音スクリプト
#!/bin/bash
LANG=ja_JP.utf8
pid=$$
date=`date '+%Y-%m-%d-%H_%M'`
playerurl=http://radiko.jp/apps/js/flash/myplayer-release.swf
playerfile="/tmp/player.swf"
keyfile="/tmp/authkey.png"
.theme-dark {
--text-accent: hsla(250, 54%, 65%, 1);
--text-accent-hover: hsla(248, 71%, 72%, 1);
}
body {
--font-monospace: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace, Courier;
}
.markdown-preview-view code {
@dragonman225
dragonman225 / nctu-login.sh
Created February 5, 2020 06:34
Login NCTU dorm network from the command line
#!/bin/bash
# Login NCTU
UA="User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:71.0) Gecko/20100101 Firefox/71.0"
BASE_URL="https://dorm.nctu.edu.tw"
PATH="/cgi-bin/ace_web_auth.cgi?web_jumpto=&orig_referer=www.google.com"
read -p "Student ID : " username
read -p "NCTU Portal Password : " password
@dragonman225
dragonman225 / .eslintrc.json
Last active January 18, 2020 15:51
ESLint config for TypeScript (typescript-eslint)
{
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": true
},
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint"