This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Post-processing fix for Earcut's issue https://github.com/mapbox/earcut/issues/74 | |
| // Split triangle edges wherever another vertex lies strictly on them (exact-coordinate input). | |
| export function removeTJunctions(data, tri) { | |
| const n = data.length / 2; | |
| // bucket every vertex into a uniform spatial hash so edge lookups stay local | |
| let minx=Infinity,miny=Infinity,maxx=-Infinity,maxy=-Infinity; | |
| for (let i=0;i<n;i++){const x=data[2*i],y=data[2*i+1];if(x<minx)minx=x;if(y<miny)miny=y;if(x>maxx)maxx=x;if(y>maxy)maxy=y;} | |
| const size = Math.max(maxx-minx, maxy-miny) / Math.max(1, Math.sqrt(n)) || 1; | |
| const key = (cx,cy) => cx*73856093 ^ cy*19349663; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| declare module 'TiledMap' { | |
| export namespace TMX { | |
| // cSpell:disable | |
| export interface Map { | |
| backgroundcolor?: string; | |
| class?: string; | |
| compressionlevel: number; | |
| height: number; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // export { default as Tap } from "./Tap"; | |
| // export { default as DoubleTap } from "./DoubleTap"; | |
| // export { default as Swipe } from "./Swipe"; | |
| const { ccclass, property } = cc._decorator; | |
| @ccclass | |
| export default class Toucher extends cc.Component { | |
| @property |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Learn TypeScript: | |
| // - https://docs.cocos.com/creator/manual/en/scripting/typescript.html | |
| // Learn Attribute: | |
| // - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html | |
| // Learn life-cycle callbacks: | |
| // - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html | |
| const { ccclass, property } = cc._decorator; | |
| @ccclass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 需要设置正确的 token | |
| var token = 985700508; | |
| // 开始时间 [年,月,日,时] , 设置为null, 则为今天的整点时刻往前7天. | |
| var startTime = null; // [2019, 4, 28, 14]; | |
| // 结束时间 [年,月,日,时] , 设置为null, 则为今天的整点时刻. | |
| var endTime = null; // [2019, 5, 5, 14]; | |
| // 关键字 (微信有bug, 不是所有出现在错误信息里的字符串都能被检索) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| CURRENT=$PWD | |
| echo $CURRENT | |
| function ergodic(){ | |
| if [ -n "$1" ] ;then | |
| echo '>>>>>> ENTER [' $1 '] >>>>>>' | |
| cd $1 | |
| else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // From http://baagoe.com/en/RandomMusings/javascript/ | |
| function Alea() { | |
| return (function(args) { | |
| // Johannes Baagøe <baagoe@baagoe.com>, 2010 | |
| var s0 = 0; | |
| var s1 = 0; | |
| var s2 = 0; | |
| var c = 1; | |
| if (args.length == 0) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // From http://baagoe.com/en/RandomMusings/javascript/ | |
| function Alea() { | |
| return (function(args) { | |
| // Johannes Baagøe <baagoe@baagoe.com>, 2010 | |
| var s0 = 0; | |
| var s1 = 0; | |
| var s2 = 0; | |
| var c = 1; | |
| if (args.length == 0) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export TERM=xterm-color | |
| # for color | |
| export CLICOLOR=1 | |
| export LSCOLORS=gxfxaxdxcxegedabagacad | |
| # grep | |
| alias grep='grep --color=always' | |
| export COLOR_NC='\\e[0m' # No Color | |
| export COLOR_WHITE='\\e[1;37m' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # NewFileAtCurrentFolder | |
| import sublime_plugin | |
| import os.path | |
| class NewFileListener(sublime_plugin.EventListener): | |
| def on_new_async(self, view): | |
| if not view.window().active_view(): | |
| print("NF: no view") | |
| return |
NewerOlder