Skip to content

Instantly share code, notes, and snippets.

@tzhong
tzhong / websocket_logger.js
Last active July 10, 2022 06:35
Bookmarklet to log websocket traffic
(function() {
if (!WebSocket.prototype._send) {
WebSocket.prototype._send = WebSocket.prototype.send;
}
WebSocket.prototype.send = function(data) {
_logData("<< sending ", data);
this._send(data);
if (!this.logInited) {
@tzhong
tzhong / vim_strip_trailing_spaces
Last active December 17, 2015 03:19
Strip off trailing spaces before save
fun! <SID>StripTrailingWhitespaces()
let l = line(".")
let c = col(".")
%s/\s\+$//e
call cursor(l, c)
endfun
autocmd BufWritePre * :call <SID>StripTrailingWhitespaces()