Skip to content

Instantly share code, notes, and snippets.

@hex-ci
hex-ci / yield-to-async.js
Created July 23, 2021 08:09 — forked from pgherveou/yield-to-async.js
convert co/yield to to async/await
// 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 April 13, 2020 06:11
VSCode support multiline tabs. 让 VSCode 支持多行 Tabs.
  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 December 4, 2020 06:55
Sketch 超长试用版,用法:安装 nodejs 和 Sketch,下载 libsketchtrial.dylib 和 sketch.js 放到同一目录下,再执行 node sketch.js
@hex-ci
hex-ci / logon-py3.py
Last active September 26, 2023 03:35
SecureCRT logon script for google authenticator.
# $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 March 13, 2019 08:55
parse query string
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 December 20, 2017 03:37
Axios 访问 Vue.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 November 17, 2017 16:54
Axios with QueryString form data.
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 October 17, 2017 03:56
基于 CodeIgniter 分页类的 Vue 分页组件 - Pagination
<?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 04:02
My 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 January 9, 2020 01:18
基于 itchat 的微信机器人例子,支持浏览器登录机器人,支持机器人进程管理,支持热重启
<!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 %}