Skip to content

Instantly share code, notes, and snippets.

🍎
一只想变成橘子的苹果

billyct billyct

View GitHub Profile
@billyct
billyct / antd.mix.js
Last active Apr 12, 2018
laravel-mix customizable antd theme.
View antd.mix.js
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 / unescapedFiles.php
Last active Mar 9, 2018
unescape unicode files under path
View unescapedFiles.php
<?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 / months_mapping.php
Last active Jan 4, 2018
Abbreviations of the Names of the Months
View months_mapping.php
<?php
$mapping = [
'Jan' => 'Jan.',
'Feb' => 'Feb.',
'Mar' => 'Mar.',
'Apr' => 'Apr.',
'May' => 'May',
'Jun' => 'June',
'Jul' => 'July',
@billyct
billyct / rabbit.txt
Created Jun 22, 2017
art of rabbit for climate lib (php)
View rabbit.txt
,
/| __
/ | ,-~ /
Y :| // /
| yy /( .^
>-"~"-v"
/ Y
j<blink>o o</blink> |
( ~T~ j
>._-' _./
View emacs-font.lisp
(setq fonts
(cond ((eq system-type 'darwin) '("Monaco" "STHeiti"))
((eq system-type 'gnu/linux) '("Menlo" "WenQuanYi Zen Hei"))
((eq system-type 'windows-nt) '("Consolas" "Microsoft Yahei"))))
(set-face-attribute 'default nil :font
(format "%s:pixelsize=%d" (car fonts) 14))
(dolist (charset '(kana han symbol cjk-misc bopomofo))
(set-fontset-font (frame-parameter nil 'font) charset
(font-spec :family (car (cdr fonts)))))
;; Fix chinese font width and rescale
@billyct
billyct / 00.howto_install_phantomjs.md
Created Jan 12, 2017 — forked from julionc/00.howto_install_phantomjs.md
How to install PhantomJS on Debian/Ubuntu
View 00.howto_install_phantomjs.md

How to install PhantomJS on Ubuntu

Version: 1.9.8

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev
@billyct
billyct / admin(v2).js
Created Jan 11, 2017 — forked from jwalton512/admin(v2).js
Harmony with Laravel + Vue + Vue Router
View admin(v2).js
// dashboard component
var dashboard = Vue.extend({
template: '<p>Hello from dashboard</p>'
})
// user management component
var user = Vue.extend({
template: '<p>Hello from user management page</p>'
})
@billyct
billyct / script.sh
Created Jan 11, 2017 — forked from srph/script.sh
envoyer: remove old releases
View script.sh
# https://laracasts.com/discuss/channels/envoyer/envoyer-inspired-envoy-script
rm -rf `ls -dt {{project}}/releases/* | tail -n +6`;
@billyct
billyct / weibo.js
Created Oct 16, 2016 — forked from yongjhih/weibo.js
Weibo Parse Cloud
View weibo.js
function s4() {
return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
};
function guid() {
return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
s4() + '-' + s4() + s4() + s4();
};
function guid20() {
@billyct
billyct / do-change-url-in-css.js
Created Oct 4, 2016
it work nice when you want change the image url in your css, and copy the image to the new path
View do-change-url-in-css.js
const fs = require('fs');
const path = require('path');
const exec = require('child_process').exec;
const filename = path.resolve(__dirname, 'index.css');
fs.readFile(filename, 'utf8', (err, data) => {
if (err) throw err;
var reg = new RegExp(/'([a-zA-z_0-9]+(?:.jpg|.png))'/, 'g');
You can’t perform that action at this time.