Skip to content

Instantly share code, notes, and snippets.

View IDisposable's full-sized avatar

Marc Brooks IDisposable

View GitHub Profile
@71
71 / boorkmarklet.md
Last active April 18, 2024 19:39
Lists all participants in a Google Meet meeting.

The following bookmarket shows a popup with the name of the participants separated by newlines.

javascript:-function(maxStrLength = 2000) { try { function findParticipants(current, depth = 0) { if (depth > 7) return; if (typeof current !== "object" || current === null || current === window) return; const descriptors = Object.getOwnPropertyDescriptors(current); for (const prop in descriptors) { if (prop.startsWith('["spaces/')) return Object.values(current); const item = findParticipants(descriptors[prop].value, depth + 1); if (item !== undefined) return item; } } const rootState = Object.entries(window).find(x => x[0].startsWith("closure_lm_"))[1], participants = findParticipants(rootState), names = []; function findName(obj) { for (const prop in obj) { const value = obj[prop]; if (typeof value === "object" && value !== null && typeof value[1] === "string") return value[1]; } } for (let i = 0; i < participants.length; i++) { const name = findName(participants[i]); if (names.indexOf(name) === -1) names.
//#define run
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
Handlebars.registerHelper('slugify', function(title) {
return title.toLowerCase()
.replace(/ /g,'-')
.replace(/[^\w-]+/g,'');
});
@monoman
monoman / Thanks to Hao Kung, b_levitt
Created October 27, 2014 16:19
Add to Global.asax.cs and call InitJQuery on Application_Start() to avoid "WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for 'jquery'" on migrating to ASP.NET 4.5
Based on **b_levitt** answer to http://stackoverflow.com/questions/16660900/webforms-unobtrusivevalidationmode-requires-a-scriptresourcemapping-for-jquery
But avoiding hardcoding the jQuery version (doesn't play nice with nuget) by using some regex as explained by **Hao Kung** on http://stackoverflow.com/questions/12029161/version-wildcard-in-mvc4-bundle
public class ImageContent : HttpContent
{
private Image _image;
public ImageContent(Image image, MediaTypeHeaderValue mediatype)
{
_image = image;
Headers.ContentType = mediatype;
}
public class FileContent : HttpContent
{
private const int DefaultBufferSize = 1024 * 64;
private readonly string _fileName;
private readonly FileInfo _fileInfo;
public FileContent(string fileName, MediaTypeHeaderValue contentType = null)
{
Headers.ContentType = contentType ?? new MediaTypeHeaderValue("application/octet-stream");
@dudleystorey
dudleystorey / auto-generated range ticks
Created April 27, 2014 07:17
Creates an auto-generated series of option values to generate ticks for Chrome & IE10 range sliders. slider requires min,max,step and list attributes.
function ticks(element) {
if (element.hasOwnProperty('list') && element.hasOwnProperty('min') && element.hasOwnProperty('max') && element.hasOwnProperty('step')) {
var datalist = document.createElement('datalist'),
minimum = parseInt(element.getAttribute('min')),
step = parseInt(element.getAttribute('step')),
maximum = parseInt(element.getAttribute('max'));
datalist.id = element.getAttribute('list');
for (var i = minimum; i < maximum+step; i = i + step) {
datalist.innerHTML +="<option value="+i+"></option>";
}
@nsbingham
nsbingham / ngrok-with-IISExpress.md
Last active December 18, 2020 20:29
How to get ngrok working with IISExpress/Visual Studio 2013
  1. Decide on a subdomain to use with ngrok. This makes the whole process easier.
  2. Open up a Command Prompt in Administrator mode and run the following command to register the URL with HTTP.sys replacing "modernie" with your subdomain and ##### with your VisualStudio/IISExpress application's port.
netsh add urlacl url=http://modernie.ngrok.com:##### user=everyone
  1. Edit your applicationhost.config. The easiest way to is start up the site and right-click the IISExpress icon in the System Tray. Click "Show All Applications" and select your website running at localhost:#####. Click the path next to "Config" to open the file in an editor.
  2. Search for you site's <bindings> configuration. The easiest way is to search for *:#####:localhost, which should bring you to the <bindings> section for your site. Edit them to include the following: