Skip to content

Instantly share code, notes, and snippets.

@zhuzhonghua
zhuzhonghua / longspacectrl.ahk
Created January 21, 2019 02:22
长按space当修饰键ctrl
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
StringCaseSense, On
AnyKeyPressedOtherThanSpace(mode = "P") {
keys = 1234567890-=qwertyuiop[]\asdfghjkl;'zxcvbnm,./
Loop, Parse, keys
{
@zhuzhonghua
zhuzhonghua / c-tab.el
Created February 16, 2015 00:40
emacs c-tab
(global-set-key (kbd "C-<tab>") '(lambda ()
(interactive)
(switch-to-buffer nil)))
@zhuzhonghua
zhuzhonghua / point-on-segment.cpp
Created February 8, 2015 09:48
point-on-segment
bool PathPlanner::isPointOnSeg(Vector2D pos, unsigned int start, unsigned int end)
{
Vector2D p1=mPath[start];
Vector2D p2=mPath[end];
// 矩形
bool flag1=false;
if (p1.x <= pos.x && pos.x <=p2.x &&
p1.y <= pos.y && pos.y <= p2.y)
{
@zhuzhonghua
zhuzhonghua / scrollview-scroll-big-scale-center.lua
Created February 7, 2015 03:46
scrollview-scroll-big-scale-center
local ActivityPage = CommonContentPage:new()
package.loaded[...] = ActivityPage
require('MessageBox.DrawGamblePage')
require('MessageBox.DivineGamblePage')
require('MessageBox.RechargeActivityPage')
require('MessageBox.DailySignInPage')
local allActivity={[1]="mLuckDivine",[2]="mLuckDraw",[3]="mSignIn",
[4]="mSingle",[5]="mRecharge",[6]="mAwait"}
@zhuzhonghua
zhuzhonghua / emacs-org-mode-tabl-chinese-align.el
Created February 7, 2015 03:45
emacs-org-mode-tabl-chinese-align.elisp
;;
(eval-when-compile (require 'cl))
(defun set-font (english chinese english-size chinese-size)
(set-face-attribute 'default nil :font
(format "%s:pixelsize=%d" english english-size))
(dolist (charset '(kana han symbol cjk-misc bopomofo))
(set-fontset-font (frame-parameter nil 'font) charset
(font-spec :family chinese :size chinese-size))))
function getDayLeftTime()
-- body
local curTime = getServerTime()
local dayAfterTime = curTime+24*60*60
local dayAfterDate = os.date("*t", dayAfterTime)
local dayAfterZeroTime = os.time({year=dayAfterDate.year,month=dayAfterDate.month,day=dayAfterDate.day})
return dayAfterZeroTime-curTime
end
local ClientSocket = {}
local socket = require("socket.core")
local sockInst = nil
-- ------------------------------------------------
local connStatus = nil
local SOCK_STATUS={INIT=1, CONNECTING=2, CONNECTED=3,DISCONNECT=4,FORCEDISCONNECT=5}
local connTime = nil
local tryConnTimes = 0
var MongoClient = require('mongodb').MongoClient,
db;
// Initialize connection once
MongoClient.connect("mongodb://localhost:27017/location", function(err, database) {
if (err) throw err;
db = database;
var places = db.collection('places');
/**********************************************************************
Filename : xxx
**********************************************************************/
替换类似这样的字符串
1. 先写正则表达式找到他们
\/\*+([^\*]|\r|\n)+\*+\/
2. 然后用自己喜欢的文字替换,或者直接删除也行
@zhuzhonghua
zhuzhonghua / gist:ab97855e11be13d72b6c
Last active August 29, 2015 14:11
turn chrome browser into a text editor
data:text/html, <html contenteditable>
data:text/html, <html><body style="" contenteditable spellcheck="false">