Skip to content

Instantly share code, notes, and snippets.

View ekwoodrich's full-sized avatar

Eliot Woodrich ekwoodrich

View GitHub Profile
paradite / paste.js
Last active January 24, 2023 10:48
intercept paste and do formatting in JavaScript (in Angular.js)
View paste.js
// tested in Chrome and Firefox
this.onPaste = function (event) {
if($(':focus')) {
// actually typing on the element, stop paste progation to outside paste handler
// intercept paste and format the text
var newText = (event.originalEvent || event).clipboardData.getData('text/plain');
newText = newText.replace(/\r?\n/g, ' ');
667bdrm /
Last active September 10, 2022 16:54
Simple clock synchronization for some chinese DVRs supporting CMS with json-like protocol. Includes some other API commands. Fork at
# latest release at
# Simple clock synchronization for some chinese HiSilicon based DVRs supporting CMS (Sofia software) with json-like protocol. Tested with:
# HJCCTV HJ-H4808BW (XiongMai, Hi3520, MBD6304T)