Skip to content

Instantly share code, notes, and snippets.

View doctorpangloss's full-sized avatar

Benjamin Berman doctorpangloss

View GitHub Profile
DocumentViewer.SUPPORTED_MIMETYPE_MAP = {
office: [
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'application/vnd.ms-word.document.macroenabled.12',
'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
'application/vnd.ms-word.template.macroenabled.12',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'application/vnd.ms-excel.sheet.macroenabled.12',
'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
'application/vnd.ms-excel.template.macroenabled.12',
@doctorpangloss
doctorpangloss / bunderru
Created November 28, 2014 03:51
productive evening
// Copy and paste into console, hit enter
var walker = document.createTreeWalker(
document.body,
NodeFilter.SHOW_TEXT,
null,
false
);
var node;
if (Meteor.isServer) {
WebApp.connectHandlers.use("/test", function (req, res, next) {
var data = '';
req.on('data', function (chunk) {
data += chunk;
});
req.on('end', Meteor.bindEnvironment(function () {
var deserialized = JSON.parse(data);
// Do your work here
console.log(deserialized.d.length);
// Provide an argument to a "multiplexing" event
class EventDispatcher {
public delegate void EventHandler(MessageEvent e);
public event EventHandler MultiplexedEvent;
}
class MessageEvent {
int MessageType; // Guess what component I'm working on which does something very similar to this
object Data;
}
{
"Config": {
"MusicOn": true,
"IsNewUser": false,
"GameId": "a4af73cb-abcd-44a7-b3fd-54a414913d74",
"PersistedGameState": {},
"Inventory": {
"LineItems": []
},
"TutorialType": 1,

###Pros:

  1. Correctly uses inheritance, for the most part.
  2. Good namespacing.
  3. JavaScript properties are sort of advanced. Nobody uses them though.
  4. Good formatting.
  5. Completed sections are all error-free on their returns.

###Cons:

  1. this.name = n ? n : ''; is totally weird. If it's supposed to be a default value, it should be n = n || '', but '' is null anyway, so it would seem that it should actually say null and not '', which would be an untitled vehicle (?).
// FloorStoreRowDocument has been changed from a class to a struct
var gameDocument = ...
var count = gameDocument.floorStore.rows.Length;
var newFloorStoreRows = new FloorStoreRowDocument [count];
Array.Copy (gameDocument.floorStore.rows, newFloorStoreRows, count);
function textNodesUnder(el){
var n, a=[], walk=document.createTreeWalker(el,NodeFilter.SHOW_TEXT,null,false);
while(n=walk.nextNode()) a.push(n);
return a;
}
textNodesUnder(document.body).forEach(function(a) {a.textContent = a.textContent.replace(/data/g,'tuna').replace(/Data/g, 'Tuna');});
From Visualizing the Metagame https://hearthsim.info/blog/2016/visualizing-the-metagame/
Of 6112 deck pairs, 157 had 2-card (1 replacement) differences.
Of those 157, 7 pairs had statistically significantly different win rates.
Deck #51 (MIDRANGE_SHAMAN):
Harrison Jones (#1) -> Barnes (#1)
Winrate changes 6.090000 percentage points (2808 matches)
Deck #51 (MIDRANGE_SHAMAN):
@doctorpangloss
doctorpangloss / cardimpact.ipynb
Created December 27, 2016 22:10
Single Card Replacement Deck Improvements
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.