Skip to content

Instantly share code, notes, and snippets.

View savokiss's full-sized avatar
😉
Focusing

savokiss savokiss

😉
Focusing
View GitHub Profile
@savokiss
savokiss / auto_pool_token.md
Created June 15, 2023 11:05 — forked from pengzhile/auto_pool_token.md
auto pool token
  1. 通过 pip install pandora-chatgpt 安装依赖。
  2. 保存以下代码到auto_pool_token.py文件。
  3. 同目录新建文件credentials.txt一行一个账号密码。
  4. 账号和密码之间用,分隔,不需要额外的引号。
  5. 如果需要修改代理,unique_name等,自行修改再运行。
  6. 运行这个auto_pool_token.py
  7. 你会看到运行进度,运行完成可看到pool token
  8. 运行中间结果分别保存在同目录tokens.txtshare_tokens.txt中。
@savokiss
savokiss / using-eslint-with-prettier.md
Last active May 21, 2021 10:47 — forked from yangshun/using-eslint-with-prettier.md
Comparison between tools that allow you to use ESLint and Prettier together.
prettier-eslint eslint-plugin-prettier eslint-config-prettier
它是什么 导出单个功能的JavaScript模块. 一个 ESLint 插件. 一个 ESLint 配置.
它干了什么 prettier 处理代码(字符串),然后运行 eslint --fix. 输出仍然是字符串. 插件通常包含 ESLint 将检查的其他规则。 此插件在内部使用 Prettier,并且当您的代码与 Prettier 的预期输出不同时,它将抛出 ESLint 错误。. 此配置关闭了可能与 Prettier 冲突的与格式相关的规则,从而让你可以将 Prettier 与其他 ESLint 配置一起使用,如 eslint-config-airbnb.
如何使用 要么写代码实现,要么通过 prettier-eslint-cli 用命令行实现. 配置 .eslintrc. 配置 .eslintrc.
最终输出是否符合 Prettier 规范? 取决于你的 ESLint 配置
是否需要单独运行 prettier 命令?
是否还需要其他工具? 你可能需要使用 eslint-config-prettier 来关闭有冲突的规则.

Phaser Cheatsheet

This is the content from the original Phaser cheatsheet, the site of which went down. I'm editing outdated information as I come across it.

Starting a new game

Reference: http://docs.phaser.io/Phaser.Game.html#Game

var game = new Phaser.Game(width, height, renderer, "parent");
//All parameters are optional but you usually want to set width and height
//Remember that the game object inherits many properties and methods!
{"sig":"d2b989c58128d016faac4c86b3de2dcc23d12f1c384cb20cfaa69ebf9414ade123dcc83f60dc56e3aac38178a0d5cee7b7350286178f9d432d98dc320d92a32f0","msghash":"9fa0a88ff7f87161a6b603ecd29f9416c1ab271def1b25146c8d94a845ef09d5"}
var Class = (function() {
function init() {
return function() {
if (this.initialize) {
this.initialize.apply(this, arguments);
}
};
}
import Class from './class'
var Event = Class({
initialize : function() {
this.__event = window.Zepto && window.Zepto.Events ? new window.Zepto.Events : $({});
}
});
var proto = Event.prototype;
import Event from './event';
const Drag = function(){
var win = $(window);
function clearSelection() {
if(window.getSelection)
window.getSelection().removeAllRanges();
else if(document.selection)
var userAgent = navigator.userAgent.toLowerCase();
// userAgent = 'Mozilla/5.0 (iPod; CPU iPhone OS 6_0_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Mobile/10A523'.toLowerCase();
// userAgent = 'Mozilla/5.0 (Linux; U; Android 4.0.3; zh-cn; N12 Build/IML74K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30'.toLowerCase();
// userAgent = 'Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0; NOKIA; Nokia 710)'.toLowerCase();
// userAgent = 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0; Touch)';
var browserUA = {
@savokiss
savokiss / Net.js
Created December 31, 2017 14:20
Utils
const Net = (function(exports) {
/**
* 在页面里动态嵌入js最轻量的方法
* @param {string} url get请求的参数,防止缓存的随机数,jsoncallback都应该手动加在这里
* @param {Object|function} op 配置参数或回调函数,op.charset表示js文件的编码
*/
exports.getScript = function(url, op){
var s = document.createElement("script");
s.type = "text/javascript";
@savokiss
savokiss / capitalize.js
Created December 13, 2017 02:09
Capitalize first letter with regexp
const capitalizeEveryWord = str => str.replace(/\b[a-z]/g, char => char.toUpperCase());
// capitalizeEveryWord('hello world!') -> 'Hello World!'