Skip to content

Instantly share code, notes, and snippets.

View pokka's full-sized avatar
🌮
I may be slow to respond.

Pokka pokka

🌮
I may be slow to respond.
View GitHub Profile
@pokka
pokka / wechat-browser-detect.js
Last active January 20, 2025 17:27 — forked from cary929/wechat-browser-detect.js
JavaScript 判断是否微信内置浏览器
// 使用 userAgent 判断是否微信内置浏览器
if( navigator.userAgent.toLowerCase().indexOf('micromessenger') > -1 || typeof navgator.wxuserAgent !== "undefined" ) {
return true;
}
@pokka
pokka / postForm.js
Created August 10, 2016 02:41
javascript es6 post data via form
function postForm(path, params = {}) {
const form = document.createElement('form');
form.setAttribute('method', 'post');
form.setAttribute('action', path);
Object.keys(params).forEach((key) => {
if (params.hasOwnProperty(key)) {
const hiddenField = document.createElement('input');
hiddenField.setAttribute('type', 'hidden');
hiddenField.setAttribute('name', key);
hiddenField.setAttribute('value', params[key]);
(function() {
// Adding upload button to Trix toolbar on initialization
document.addEventListener('trix-initialize', function(e){
trix = e.target;
toolBar = trix.toolbarElement;
// Creation of the button
button = document.createElement("button");
button.setAttribute("type", "button");
button.setAttribute("class", "attach");
@pokka
pokka / supervisor.conf
Created February 28, 2017 02:33
supervisor example conf file
[unix_http_server]
file=/tmp/supervisor.sock
;username = dongwm
;password = 123
[inet_http_server]
port = 0.0.0.0:5000
username = dongwm
password = 123