What is the most reliable way to hide / spoof the referrer in JavaScript?

I have found a solution which works in Chrome and Firefox. I’ve implemented the code in a Userscript, Don’t track me Google. Demo (tested in Firefox 9 and Chrome 17): http://jsfiddle.net/RxHw5/ Referrer hiding for Webkit (Chrome, ..) and Firefox 37+ (33+*) Webkit-based browsers (such as Chrome, Safari) support <a rel=”noreferrer”>spec. Referrer hiding can fully be … Read more

Global mouse event handler

return SetWindowsHookEx(WH_MOUSE_LL, proc, GetModuleHandle(curModule.ModuleName), 0); This code will fail when you run it on .NET 4 on a Windows version earlier than Windows 8. The CLR no longer simulates unmanaged module handles for managed assemblies. You can’t detect this failure in your code because it is missing the required error checking. Both on GetModuleHandle and … Read more

Vue JS : right click event directive

<button @contextmenu=”handler($event)”>r-click</button> methods : { handler: function(e) { //do stuff e.preventDefault(); } } @contextmenu will do the trick. The preventDefault is to avoid showing the default context menu. Shorter, as indincated in the comment : <button @contextmenu.prevent=”handler”>r-click</button> Now the prevent modifier takes care preventing default behaviour. Edit: For this to work with vue components, add … Read more

Store mouse click event coordinates with matplotlib

mpl_connect needs to be called just once to connect the event to event handler. It will start listening to click event until you disconnect. And you can use fig.canvas.mpl_disconnect(cid) to disconnect the event hook. What you want to do is something like: import numpy as np import matplotlib.pyplot as plt x = np.arange(-10,10) y = … Read more

Weak performance of CGEventPost under GPU load

I guess you’re filling up the queue (underlying mach port)… You can confirm this using the “scheduling” or “system call” instrument in Instruments. (Create a new blank document, add the instrument, then under File > Record Options… make sure “deferred mode” is checked.) This will show all thread activity in your app (when threads block, … Read more