Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Meathill meathill

🏠
Working from home
Block or report user

Report or block meathill

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:45895ec8d59fad9935f187eba2e3fb19
<?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>
View gist:9fda72dc12fa98dea64df372cc170af2
<?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'));
View gist:baeadf2ccbda950ade7f7b8958b899af
body {
font-family: "Helvetica Neue",Helvetica,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","微软雅黑",Arial,sans-serif;
}
@meathill
meathill / gist:14368b26d6a467461551
Created Feb 16, 2016
make FileReader thenable
View gist:14368b26d6a467461551
function reader (file, options) {
options = options || {};
return new Promise(function (resolve, reject) {
let reader = new FileReader();
reader.onload = function () {
resolve(reader);
};
reader.onerror = reject;
@meathill
meathill / convertHandlebarsToMustache
Last active Dec 21, 2015
Convert template from Handlebars to Mustache
View convertHandlebarsToMustache
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
});
}
You can’t perform that action at this time.