Skip to content

Instantly share code, notes, and snippets.

javascript:(function(){document.documentElement.style += "; filter: invert(0.9) hue-rotate(180deg); background-color: rgba(0,0,0,.9);"; document.head.innerHTML += "<style>img, video{filter: invert(1) hue-rotate(180deg);}</style>";}())
@genriquez
genriquez / clickonce-sha256-sign.targets
Last active March 15, 2021 15:32
Add this to csproj file to force SHA-1 digest for clickonce app publishing when using a SHA-256 certificate.
<!-- Copied from Microsoft.Common.CurrentVersion.targets -->
<Target
Name="_DeploymentSignClickOnceDeployment">
<!-- Sign manifests and the bootstrapper -->
<SignFile
CertificateThumbprint="$(_DeploymentResolvedManifestCertificateThumbprint)"
TimestampUrl="$(ManifestTimestampUrl)"
SigningTarget="$(_DeploymentApplicationDir)$(_DeploymentTargetApplicationManifestFileName)"
TargetFrameworkVersion="v4.0"
@genriquez
genriquez / hellospace.js
Created March 5, 2017 22:11
My take on the Hello Space Reaktor challenge
var telemetryWindow = window.open(null, "telemetry").document.body;
telemetryWindow.style = "font-family: monospace; white-space: pre;";
var stages = [
{ end: 6005, control: { thrust: 0, rcs: { pitch: 0, yaw: 0 }}},
{ end: 291, control: { thrust: 1, rcs: { pitch: 0, yaw: 0.022 }}},
{ end: 291, control: { thrust: 0, rcs: { pitch: 0, yaw: -0.022 }}},
{ end: 2300, control: { thrust: 0, rcs: { pitch: 0, yaw: 0.00008 }}},
{ end: 100, control: { thrust: 1, rcs: { pitch: 0, yaw: 0 }}},
{ end: -1, control: { thrust: 0, rcs: { pitch: 0, yaw: 0.0 }}}
@genriquez
genriquez / gauge.css
Created June 5, 2015 20:23
CSS Gauge (no js) - style .gauge and .gauge-meter elements for updating values/look&feel,update html to change label
.gauge {
display: inline-block;
position: relative;
width: 2em;
height: 1em;
overflow: hidden;
border-top-left-radius: 1em;
@genriquez
genriquez / ie5html5converter.js
Last active August 29, 2015 14:06
IE5 HTML5 re-writer: Converts an HTML5 document into an IE5-compatible format, using DIV wrappers with 'html-element' classes for styling. A special CSS stylesheet must be provided, wich can be created using a simple regex.
window.onload = function () {
var html = document.body.innerHTML;
var tags = ["SECTION", "HEADER", "FOOTER", "ARTICLE", "NAV", "ASIDE", "section", "header", "footer", "article", "nav", "aside"];
for(var i = 0; i<tags.length; i++) {
var match;
while(match = html.indexOf("<" + tags[i]) != -1) {
html = html.replace("<" + tags[i], "<DIV class='html-" + tags[i].toLowerCase() + "'><DIV");
}
@genriquez
genriquez / gist:8926361
Created February 10, 2014 23:29
Removing nameless cookies from Selenium RemoteWebDriver to avoid exception when requesting AllCookies
// Delete nameless cookies (do not use DeleteCookieNamed method as it has a glitch that removes too many cookies when using empty name)
(driver as OpenQA.Selenium.Remote.RemoteWebDriver).ExecuteScript("document.cookie = '; expires=Thu, 01 Jan 1970 00:00:00 GMT';");
// Won't throw exception
driver.Manage().Cookies.AllCookies
@genriquez
genriquez / gist:8722660
Created January 30, 2014 23:52
Cancellable jQuery deferreds
/*
Returns a wrapped deferred object with a new cancel method
Note: All done callback parameters are wrapped in arrays from each deferred
*/
$.asCancellableDeferred = function (dfr) {
var cancelFuse = $.Deferred();
// If the original deferred is resolved before it is canceled, defuse the cancel trigger
// to allow the done operation to be notified across all handlers