This file contains 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
executeApplicationScript: function(message, sendReply) { | |
for (var key in message.inject) { | |
window[key] = JSON.parse(message.inject[key]); | |
} | |
loadScript(message.url, sendReply.bind(null, null)); | |
} | |
function loadScript(src, callback) { | |
var script = document.createElement('script'); | |
script.type = 'text/javascript'; |
This file contains 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 runServer(options, readyCallback) { | |
var app = connect() | |
.use(loadRawBody) | |
.use(openStackFrameInEditor) | |
.use(getDevToolsLauncher(options)) | |
.use(statusPageMiddleware) | |
// Temporarily disable flow check until it's more stable | |
//.use(getFlowTypeCheckMiddleware(options)) | |
.use(getAppMiddleware(options)); |
This file contains 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
array | |
0 => | |
array | |
0 => | |
object(stdClass)[288] | |
public 'block_time_id' => string '492413' (length=6) | |
public 'exception_date' => string '2012-12-10' (length=10) | |
1 => | |
array | |
0 => |
This file contains 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
array | |
492413 => | |
array | |
0 => | |
object(stdClass)[288] | |
public 'exception_date' => string '2012-12-10' (length=10) | |
492414 => | |
array | |
0 => | |
object(stdClass)[289] |
This file contains 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
// NOTE: This is written using ES6 - make sure your JavaScript compiler is ES6 compliant | |
class StringPermutation { | |
constructor(str) { | |
this.originalString = str.slice(); // deep copy string | |
} | |
printAllPermutationsWithDuplicates() { | |
this.permutate( |
This file contains 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
class Node { | |
constructor(value = "", parent = undefined) { | |
this.value = value; | |
this.parent = parent; | |
this.children = []; | |
if (this.parent != undefined) { | |
this.parent.children.push(this); | |
} | |
} |
This file contains 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 dec2bin(dec){ | |
var str = (dec >>> 0).toString(2); | |
return (str.length < 32) ? Array(32 - str.length).fill(0).join('').concat(str) : str; | |
} |
This file contains 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
class Node { | |
constructor(value, next) { | |
this.value = value; | |
this.next = next; | |
} | |
} | |
function getRandom(list, k) { | |
const reservoir = new Array(k); |
This file contains 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
class Spec: QuickSpec { | |
override func spec() { | |
beforeSuite { | |
print("☕️ before suite") | |
} | |
afterSuite { | |
print("🗑 after suite") | |
} |
This file contains 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
// Print all permutations of a string in JavaScript (ES6) | |
// O(2^n) runtime | |
class StringSubsets { | |
constructor(str) { | |
this.str = str; | |
} | |
print() { | |
const map = new Map(); |