Skip to content

Instantly share code, notes, and snippets.

View meathill's full-sized avatar

Meathill meathill

View GitHub Profile
@meathill
meathill / RFC.md
Last active October 23, 2022 03:56
TiDB Hackathon 2022 RFC
@meathill
meathill / gist:14368b26d6a467461551
Created February 16, 2016 14:53
make FileReader thenable
function reader (file, options) {
options = options || {};
return new Promise(function (resolve, reject) {
let reader = new FileReader();
reader.onload = function () {
resolve(reader);
};
reader.onerror = reject;
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" xml:space="preserve" width="1" height="1">
<rect x="0" y="0" width="1" height="1" fill="#AAAAAA"></rect>
</svg>
@meathill
meathill / gist:9fda72dc12fa98dea64df372cc170af2
Last active September 5, 2016 07:58
php 的日期操作
<?php
// 这两者是等效的
$yesterday = date('Y-m-d', time() - 86400);
$yesterday = date('Y-m-d', strototime('-1 day'));
// 上个月第一天
$date = date('Y-m-d', strtotime('first day of last month'));
// 上个月最后一天
$date = date('Y-m-d', strtotime('last day of last month'));
body {
font-family: "Helvetica Neue",Helvetica,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","微软雅黑",Arial,sans-serif;
}
@meathill
meathill / convertHandlebarsToMustache
Last active December 21, 2015 20:29
Convert template from Handlebars to Mustache
function convertToMustache(str) {
var stack = [],
reg = /{{([#\/]?)(\w+)?\s?(..\/)?(\w+)?}}/g;
str = str.replace(reg, function (match, pre, helper, path, key) {
if (pre === '#') {
stack.push({
type: helper,
key: key
});
}