Skip to content

Instantly share code, notes, and snippets.

Robin Herbots RobinHerbots

  • Belgium
Block or report user

Report or block RobinHerbots

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@RobinHerbots
RobinHerbots / gist:5eda12d1921c9c8bcd7737aec327ec9a
Created Jun 21, 2019 — forked from pmhsfelix/gist:4151369
Generating and validating JWT tokens using JWTSecurityTokenHandler
View gist:5eda12d1921c9c8bcd7737aec327ec9a
[Fact]
public void First()
{
var tokenHandler = new JWTSecurityTokenHandler();
var symmetricKey = GetRandomBytes(256/8);
var now = DateTime.UtcNow;
var tokenDescriptor = new SecurityTokenDescriptor
{
Subject = new ClaimsIdentity(new Claim[]
@RobinHerbots
RobinHerbots / uriSchemeWithHyperlinkFallback.js
Created Dec 6, 2018 — forked from ChaseFlorell/uriSchemeWithHyperlinkFallback.js
Ever want to launch a mobile app from within the browser, but ensure that the browser still redirects the user to the link if the app isn't installed? This took some fiddling around, but when the "ah ha" moment hit, the solution is really quite simple.
View uriSchemeWithHyperlinkFallback.js
// tries to execute the uri:scheme
function uriSchemeWithHyperlinkFallback(uri, href) {
// set up a timer and start it
var start = new Date().getTime(),
end,
elapsed;
// attempt to redirect to the uri:scheme
// the lovely thing about javascript is that it's single threadded.
// if this WORKS, it'll stutter for a split second, causing the timer to be off
View uriSchemeWithHyperlinkFallback.js
// tries to execute the uri:scheme
function uriSchemeWithHyperlinkFallback(uri, href) {
if(!window.open(uri)){
window.location = href;
}
}
@RobinHerbots
RobinHerbots / 52-nvidia-coolbits.conf
Last active Jan 22, 2018
nvidia coolbits config for Ubuntu 17.10 (cp /usr/share/X11/xorg.conf.d/)
View 52-nvidia-coolbits.conf
Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
Option "Coolbits" "12"
SubSection "Display"
Depth 24
EndSubSection
EndSection
@RobinHerbots
RobinHerbots / index.ejs
Created Feb 23, 2017 — forked from ksrb/index.ejs
jquery.inputmask webpack configuration and package.json
View index.ejs
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<input id="float"/>
</body>
</html>
@RobinHerbots
RobinHerbots / index.ejs
Created Feb 23, 2017 — forked from ksrb/index.ejs
jquery.inputmask webpack configuration and package.json
View index.ejs
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<input id="float"/>
</body>
</html>
View Multiple Download example
this.downloadUpload = function (rowid) {
var rowids = rowid ? [rowid] : res.Control.uploadOverview.jqGrid('getGridParam', 'selarrrow');
$.each(rowids, function (ndx, rwd) {
var downloadFrame = $("<iframe></iframe>");
downloadFrame.attr("src", '@Url.Action("DownloadFile", "Upload")?uploadId=' + rwd);
downloadFrame.on("onload", function() {
$(this).remove();
});
$("body").append(downloadFrame);
});
@RobinHerbots
RobinHerbots / jquery.ajax.progress.js
Last active Oct 8, 2018 — forked from db/jquery.ajax.progress.js
XMLHttpRequest2 progress event on $.ajax
View jquery.ajax.progress.js
(function($) {
var originalXhr = $.ajaxSettings.xhr;
$.ajaxSetup({
progress: $.noop,
xhr: function() {
var req = originalXhr(), that = this;
if (req) {
if (typeof req.addEventListener == "function") {
req.addEventListener("progress", function(evt) {
that.progress(evt);
@RobinHerbots
RobinHerbots / Global.asax
Last active Dec 14, 2015
MVC DataAnnotations - Validate submodel in model with separate result in ModelState
View Global.asax
public class MvcApplication : HttpApplication
{
protected void Application_Start()
{
ModelValidatorProviders.Providers.Add(new RecursiveModelValidatorProvider());
....
@RobinHerbots
RobinHerbots / Proxy.tt
Created Apr 26, 2012
Proxy generation template
View Proxy.tt
/*
== DO NOT EDIT THIS GENERATED FILE ==
Generated on <#=DateTime.Now.ToShortDateString()#> at <#=DateTime.Now.ToShortTimeString()#>
*/
<#@ template hostspecific="True" #>
<#@ assembly name="System.ServiceModel.dll" #>
<#@ assembly name="System.Xml" #>
<#@ assembly name="EnvDTE" #>
<#@ assembly name="Microsoft.VisualStudio.OLE.Interop" #>
You can’t perform that action at this time.