Skip to content

Instantly share code, notes, and snippets.

View billyct's full-sized avatar
🍎
一只想变成橘子的苹果

billyct billyct

🍎
一只想变成橘子的苹果
View GitHub Profile
@billyct
billyct / rabbit.txt
Created June 22, 2017 03:11
art of rabbit for climate lib (php)
,
/| __
/ | ,-~ /
Y :| // /
| yy /( .^
>-"~"-v"
/ Y
j<blink>o o</blink> |
( ~T~ j
>._-' _./
@billyct
billyct / months_mapping.php
Last active January 4, 2018 09:03
Abbreviations of the Names of the Months
<?php
$mapping = [
'Jan' => 'Jan.',
'Feb' => 'Feb.',
'Mar' => 'Mar.',
'Apr' => 'Apr.',
'May' => 'May',
'Jun' => 'June',
'Jul' => 'July',
@billyct
billyct / unescapedFiles.php
Last active March 9, 2018 12:34
unescape unicode files under path
<?php
function unescapedFiles($path){
$files = array_diff(scandir($path), array('.', '..'));
foreach ($files as $file) {
$file = str_finish($path, '/') . $file;
$content = json_decode(file_get_contents($file), true);
$content = json_encode($content, JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES);
file_put_contents($file, $content);
}
@billyct
billyct / antd.mix.js
Last active November 6, 2020 14:22
laravel-mix customizable antd theme.
let mix = require('laravel-mix');
const antdRegex = /antd.+\.less$/;
const theme = {
'primary-color': '#0097FF',
};
// Exclude quill icons
Mix.listen('configReady', function(config) {
const rules = config.module.rules;
@billyct
billyct / get_ghs_icon.sh
Created May 24, 2019 07:57
fetch echa.europa.eu ghs icon
#!/bin/bash
for i in {1..9}
do
wget "https://echa.europa.eu/diss-cl-inventory-portlet/images/pictograms/ghs0$i.png"
done
@billyct
billyct / use-hash-location.js
Created November 19, 2019 08:30
wouter hash-based routing hook
import { useEffect, useRef, useState, useCallback } from "wouter/react-deps";
export default () => {
const [path, update] = useState(currentPathname());
const prevPath = useRef(path);
useEffect(() => {
// this function checks if the location has been changed since the
// last render and updates the state only when needed.
// unfortunately, we can't rely on `path` value here, since it can be stale,
@billyct
billyct / Dockerfile
Last active January 12, 2021 08:11
国内使用 laravel/sail
FROM ubuntu:20.04
LABEL maintainer="Taylor Otwell"
ARG WWWGROUP
WORKDIR /var/www/html
ENV DEBIAN_FRONTEND noninteractive
ENV TZ=UTC