Skip to content

Instantly share code, notes, and snippets.

View dvdsmpsn's full-sized avatar

David Simpson dvdsmpsn

View GitHub Profile
@dvdsmpsn
dvdsmpsn / gist:855ea95f91ae38808eb6bc6cd9fb2b51
Created January 24, 2018 11:00 — forked from solenoid/gist:1372386
javascript ObjectId generator
var mongoObjectId = function () {
var timestamp = (new Date().getTime() / 1000 | 0).toString(16);
return timestamp + 'xxxxxxxxxxxxxxxx'.replace(/[x]/g, function() {
return (Math.random() * 16 | 0).toString(16);
}).toLowerCase();
};
@dvdsmpsn
dvdsmpsn / gist:5c98442e5af17b43858dc110ad424e0f
Last active August 19, 2023 17:56 — forked from alexis89x/broadcast-channel-es6.js
Broadcast Channel API polyfill
/**
@class BroadcastChannel
A simple BroadcastChannel polyfill that works with all major browsers.
Please refer to the official MDN documentation of the Broadcast Channel API.
======
@see <a href="https://developer.mozilla.org/en-US/docs/Web/API/Broadcast_Channel_API">Broadcast Channel API on MDN</a>
@author Alessandro Piana
@version 1.0.0
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 5.
Error Code,Description,Notes
"AADSTS50012","Invalid client secret is provided","You've used an incorrect OAuth secret. Check for typos, or go to Azure AD and generate a fresh one."
"AADSTS65004","The resource owner or authorization server denied the request","The user clicked on the *Cancel* button during the OAuth dance"
"AADSTS65005","The client application has requested access to resource 'https://outlook.office365.com/'. This request has failed because the client has not specified this resource in its requiredResourceAccess list.","Ensure that the Azure AD Application has the correct resource permissions"
"AADSTS50105","The signed in user '[email protected]' is not assigned to a role for the application 'ab0a45c7-c085-4f3f-a868-62f3927926ef'# Trace ID: c8fc15e0-2d6f-49e8-b843-00a90032585f Correlation ID: 7e8e28f0-5a5d-4409-a217-1e8363fda666 Timestamp: 2015-08-27 13:23:38Z","The user is not authorized to access the app - source: http://download.microsoft.com/download/3/E/3/3E335D93-6DB8-4834-90A8-B861
## Macro name: aui-tabs-container
## Macro title: AUI Tabs Container
## Description: A container within which to group AUI Tabs
## Categories: Confluence content
## Macro has a body: Y
##
## Developed by: David Simpson <[email protected]>
## Date created: 2016-10-19
## Installed by: Your Name
##
@dvdsmpsn
dvdsmpsn / encoded.js
Created September 26, 2016 18:42
Toggle Passwords Bookmarklet
javascript:(function()%7B%0A%0A%09var F%2Cj%2Cf%2Ci%3B %0A%09F %3D document.forms%3B %0A%09for(j%3D0%3B j<F.length%3B %2B%2Bj) %7B %0A%09%09f %3D F%5Bj%5D%3B %0A%09%09for (i%3D0%3B i<f.length%3B %2B%2Bi) %7B %0A%09%09%09if (f%5Bi%5D.type.toLowerCase() %3D%3D "password") %7B%0A%09%09%09%09f%5Bi%5D.setAttribute("data-original-type"%2C"password")%3B%0A%09%09%09%09f%5Bi%5D.type %3D %27text%27%3B%0A%09%09%09%7Delse%7B%0A%09%09%09%09if (f%5Bi%5D.getAttribute("data-original-type") %3D%3D "password") %7B%0A%09%09%09%09%09f%5Bi%5D.type %3D %27password%27%3B%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%7D %0A%09%7D %0A%7D)()%3B
host logname time method url response bytes referer useragent
pppa006.compuserve.com - 807256800 GET /images/launch-logo.gif 200 1713
vcc7.langara.bc.ca - 807256804 GET /shuttle/missions/missions.html 200 8677
pppa006.compuserve.com - 807256806 GET /history/apollo/images/apollo-logo1.gif 200 1173
thing1.cchem.berkeley.edu - 807256870 GET /shuttle/missions/sts-70/sts-70-day-03-highlights.html 200 4705
202.236.34.35 - 807256881 GET /whats-new.html 200 18936
bettong.client.uq.oz.au - 807256884 GET /history/skylab/skylab.html 200 1687
202.236.34.35 - 807256884 GET /images/whatsnew.gif 200 651
202.236.34.35 - 807256885 GET /images/KSC-logosmall.gif 200 1204
bettong.client.uq.oz.au - 807256900 GET /history/skylab/skylab.html 304 0
@dvdsmpsn
dvdsmpsn / README.md
Last active September 26, 2016 22:43
Google Analytics Setup for Atlassian Cloud Add-Ons

Google Analytics Setup for Atlassian Cloud Add-Ons

Add analytics.js to your add-on pages. Update the tracking code and Add-On / Macro Name and you should be good to go.

Custom Dimensions

You'll need to add some custom dimensions in Google Analytics. Use the names in comments in the section of analytics.js below // Add into custom dimensions

Personally Identifiable Information (PII)

Note that you must not store PII such as user_id which is sent over to Google Analytics in every request as a request parameter. Note userKey is not PII, so can be used.

@dvdsmpsn
dvdsmpsn / copyright.scala.html
Created April 13, 2016 19:59
Adding the current year to a template in Play Framework.
/*************
* POLYFILLS - for older browsers
*************/
/**
* Console-polyfill. MIT license.
* https://github.com/paulmillr/console-polyfill
* Make it safe to do console.log() always.
*/
(function(global) {