This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Utilize visibility. This will cause layout to be invalid and have to be recomputed once the element is made visible again. | |
function _clickThroughVisNested(evt) { | |
var localStyle = evt.target.style; | |
var oldVisibility = localStyle.display; | |
localStyle.visibility = "hidden"; | |
var target = document.elementFromPoint(evt.pageX, evt.pageY); | |
// Specific to my implementation. I want to only click through on certain types of elements. | |
if (target.classList.contains("achievement")) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// RangeBasedFor.cpp : Defines the entry point for the console application. | |
// | |
#include "stdafx.h" | |
template <typename T, T first = T::First, T last = T::Last> | |
class Enum | |
{ | |
static_assert(first <= last, "foo"); | |
public: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Assumes row/col are 1 indexed | |
int PascalsMath(int row, int col) | |
{ | |
// Enable mirroring about the central pivot of the row | |
col = min(col, row - col + 1); | |
int value = 1; | |
int numerator = row - 1; | |
int denominator = 1; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
double ChampagneTower(double water, double capacity, int row, int col); | |
double ChampagneTower(double water, double capacity, int cup) | |
{ | |
// The cup id is from left to right. We want the row and column in the triangular | |
// array which is basically the triangular root and our remainder. | |
int triangular_root = ceil((sqrt(8*cup+1)-1)/2); | |
int column = cup - ((triangular_root*(triangular_root-1))/2); | |
return ChampagneTower(water, capacity, triangular_root, column); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool PowerOf2(unsigned long value) | |
{ | |
return (value != 0) && !(value & (value-1)); | |
} | |
int BitCount(unsigned long value) | |
{ | |
value = (value & 0x55555555) + ((value & 0xAAAAAAAA) >> 1); | |
value = (value & 0x33333333) + ((value & 0xCCCCCCCC) >> 2); | |
value = (value & 0x0F0F0F0F) + ((value & 0xF0F0F0F0) >> 4); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var eventTargetObjects = Object.getOwnPropertyNames(window).filter(function prop(name) { | |
// This block of code identifies constructors with high confidence using casing, enumerability and prototype property presence | |
return (name[0] === name[0].toUpperCase() && !this.propertyIsEnumerable(name) && this[name].prototype !== undefined); | |
}, window).filter(function prop(name) { | |
// This block of code determines if a constructor is like an EventTarget | |
var currentPrototype = this[name].prototype; | |
while (currentPrototype !== null) { | |
if (currentPrototype === EventTarget.prototype) { | |
return true; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var config = { | |
forward_server: 'msdl.microsoft.com', | |
forward_path: '/download/symbols', | |
forward_port: 80, | |
allow_list: [ | |
/\/ntdll.pdb\// | |
], | |
}; | |
module.exports = config; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = require('request'); | |
var cheerio = require('cheerio'); | |
var urls = [ | |
'https://developer.android.com/reference/com/google/android/gms/location/Geofence.html', | |
'http://developer.android.com/reference/com/google/android/gms/maps/model/LatLng.html' | |
]; | |
urls.forEach(function (elem) { | |
request({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
function token() { | |
this.value = ''; | |
this.type = 'error'; | |
} | |
// Static methods on token | |
Object.defineProperties(token, { | |
createOther: { | |
value: function createOther(val) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://jsfiddle.net/s4ex1dtj/ | |
"use strict"; | |
var myImage = new Image(); | |
Object.defineProperty(myImage, "src", { | |
get: function () { return 'foo'; }, | |
set: function (val) { alert(val); } }); | |
console.log(myImage.src); // Logs value 'foo' | |
myImage.src = "new"; // alerts value 'new' | |
// newImage does not have a redefined setter since our previous property |