Skip to content

Instantly share code, notes, and snippets.

Avatar

Hex hex-ci

View GitHub Profile
@hex-ci
hex-ci / yield-to-async.js
Created Jul 23, 2021 — forked from pgherveou/yield-to-async.js
convert co/yield to to async/await
View yield-to-async.js
// https://astexplorer.net/#/gist/48d24982fceb3f258cc2dcd764fe8e38/937f48fc25443224a08bb20774a7d8868052770c
export default function ({types: t}) {
return {
visitor: {
ObjectMethod(path) {
if (path.node.generator) {
path.node.async = true
path.node.generator = false
}
@hex-ci
hex-ci / README.md
Last active Apr 13, 2020
VSCode support multiline tabs. 让 VSCode 支持多行 Tabs.
View README.md
  1. Windows 系统下,workbench.desktop.main.css 文件位置: [用户目录]\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench
  2. Mac 系统下,workbench.desktop.main.css 文件位置: /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench
@hex-ci
hex-ci / libsketchtrial.dylib
Last active Dec 4, 2020
Sketch 超长试用版,用法:安装 nodejs 和 Sketch,下载 libsketchtrial.dylib 和 sketch.js 放到同一目录下,再执行 node sketch.js
@hex-ci
hex-ci / logon-py3.py
Last active Apr 27, 2021
SecureCRT logon script for google authenticator.
View logon-py3.py
# $language = "python"
# $interface = "1.0"
import base64
import hmac
import struct
import sys
import time
TOTP_KEY = 'YOUR_GOOGLE_AUTH_KEY'
@hex-ci
hex-ci / parse_str.js
Created Mar 13, 2019
parse query string
View parse_str.js
function parseQueryString(str) {
var strArr = String(str).replace(/^&/, '').replace(/&$/, '').split('&')
var sal = strArr.length
var i
var j
var ct
var p
var lastObj
var obj
var chr
@hex-ci
hex-ci / demo.js
Created Dec 20, 2017
Axios 访问 Vue.js 组件的实例
View demo.js
import Vue from 'vue'
import App from './App'
import axios from 'axios'
const plugins = {
install(Vue) {
Vue.prototype.$fetch = function(url, options) {
return axios(url, options)
.then(response => {
console.log(this)
@hex-ci
hex-ci / axios-demo.js
Last active Nov 17, 2017
Axios with QueryString form data.
View axios-demo.js
import axios from 'axios'
import qs from 'qs'
const axiosInstance = axios.create({
transformRequest: [function(data) {
return qs.stringify(data);
}],
headers:{
'Content-Type': 'application/x-www-form-urlencoded'
}
@hex-ci
hex-ci / MY_Pagination.php
Last active Oct 17, 2017
基于 CodeIgniter 分页类的 Vue 分页组件 - Pagination
View MY_Pagination.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Pagination Class
*
* @package Transformers
* @subpackage Libraries
* @category Pagination
* @author Hex
@hex-ci
hex-ci / Dockerfile
Last active May 3, 2017
My Dockerfile
View Dockerfile
FROM codeigniter/nginx-php-fpm:13
# set timezone
RUN apk add --no-cache tzdata \
&& mv /usr/share/zoneinfo/Asia/Shanghai /tmp/ \
&& rm -rf /usr/share/zoneinfo/* \
&& mkdir -p /usr/share/zoneinfo/Asia \
&& mv /tmp/Shanghai /usr/share/zoneinfo/Asia/ \
&& ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo Asia/Shanghai > /etc/timezone \
@hex-ci
hex-ci / index.html
Last active Jan 9, 2020
基于 itchat 的微信机器人例子,支持浏览器登录机器人,支持机器人进程管理,支持热重启
View index.html
<!DOCTYPE html>
<!-- 请把这个文件放到 templates 目录下 -->
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>Wechat</title>
</head>
<body>
{% if alive %}