Skip to content

Instantly share code, notes, and snippets.

View inhere's full-sized avatar
😃
working, learning ...

Inhere inhere

😃
working, learning ...
View GitHub Profile
@inhere
inhere / riot-message.tag
Created February 7, 2017 04:01
riot tag component 'message' and 'pagination', basic style support by bootstrap 3
<message>
<div class="msg-box bg-{ opts.type || 'info' } fade-{ fadeMode }" if={ opts.text }>
<button type="button" class="close" onclick={ closeBox } if={ opts.close }>
<span aria-hidden="true">&times;</span><span class="sr-only">Close</span>
</button>
<h4 class="msg-title" if={ opts.title }>{ opts.title }</h4>
<ul class="msg-body">
<!-- <li><yield/></li> -->
@inhere
inhere / url_hash_and_h5_history.js
Created January 11, 2018 03:43
url hash和html5 history使用
/**
* HashHistory
* @link https://zhuanlan.zhihu.com/p/27588422
*/
// hash的改变会自动添加到浏览器的访问历史记录中。
function pushHash (path) {
window.location.hash = path
}
@inhere
inhere / local_cookie_sess_storage.js
Created January 11, 2018 03:45
浏览器本地存储 cookies, session, localStorage 使用包装
@inhere
inhere / js_extra_util.js
Last active January 11, 2018 03:47
常用的js函数,工具类封装 收集
const extra = {}
// 密码检测密码强度
extra.checkStrength = function (sValue) {
let modes = 0
if (sValue.length < 1) return modes
// 正则表达式验证符合要求的
@inhere
inhere / raw_js_ajax.js
Created January 11, 2018 03:49
原生js发送ajax
// @from http://www.cnblogs.com/kazetotori/p/6037940.html
// ajax函数的默认参数
var ajaxOptions = {
url: '#',
method: 'GET',
async: true,
timeout: 0,
data: null,
dataType: 'text',
headers: {},
@inhere
inhere / send_request_by_fetch.js
Created January 11, 2018 03:50
通过新的 fetch 方法发送 ajax 请求
const baseUrl = 'xx.com/'
export default async(url = '', data = {}, type = 'GET', method = 'fetch') => {
type = type.toUpperCase();
url = baseUrl + url;
if (type == 'GET') {
let dataStr = ''; //数据拼接字符串
Object.keys(data).forEach(key => {
dataStr += key + '=' + data[key] + '&';
@inhere
inhere / example
Last active January 11, 2018 03:57
简单快速给文档生成TOC(使用jQuery, 自动生成锚点,可添加 anchorIcon)
<style>
[data-anchor-icon]::after {
content: attr(data-anchor-icon);
}
</style>
<div id="content-toc-box">
<div class="title"><i class="fa fa-list"></i> 内容结构</div>
<div id="content-toc"></div>
</div>
@inhere
inhere / composer.scripts.json
Created January 23, 2018 01:32
the scripts config for composer
"scripts": {
"analyze": [
"@cs:check",
"@phpstan",
"@composer validate --strict"
],
"phpstan": [
"wget -nc https://github.com/phpstan/phpstan/releases/download/0.9.1/phpstan.phar",
"chmod a+x phpstan.phar",
"./phpstan.phar analyse src tests --level=2 -c phpstan.neon --no-interaction --no-progress"
@inhere
inhere / php-project.Makefile
Last active July 6, 2019 03:11
Makefile ref for php project
# link https://github.com/humbug/box/blob/master/Makefile
#SHELL = /bin/sh
.DEFAULT_GOAL := help
# 每行命令之前必须有一个tab键。如果想用其他键,可以用内置变量.RECIPEPREFIX 声明
# mac 下这条声明 没起作用 !!
.RECIPEPREFIX = >
.PHONY: all usage help clean
# 需要注意的是,每行命令在一个单独的shell中执行。这些Shell之间没有继承关系。
# - 解决办法是将两行命令写在一行,中间用分号分隔。
@inhere
inhere / swoole-nginx.conf
Created March 7, 2018 04:00
swoole 应用的nginx配置参考
server {
listen 80;
server_name www.site.dev site.dev;
root /webroot/static;
index index.html index.htm;
error_log logs/site.dev.error.log;
access_log logs/site.dev.access.log;
##### 第一个必选规则: 匹配首页