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
- (void)executeApplicationScript:(NSString *)script sourceURL:(NSURL *)URL onComplete:(RCTJavaScriptCompleteBlock)onComplete { | |
NSDictionary *message = @{ | |
@"method": @"executeApplicationScript", | |
@"url": RCTNullIfNil(URL.absoluteString), | |
@"inject": _injectedObjects, | |
}; | |
[self sendMessage:message waitForReply:^(NSError *error, NSDictionary *reply) { | |
onComplete(error); | |
}]; | |
} |
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
{ | |
"remoteModuleConfig": { | |
"RCTTiming": { | |
"methods": { | |
"deleteTimer": { | |
"type": "remote", | |
"methodID": 1 | |
}, | |
"createTimer": { | |
"type": "remote", |
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
# Gist at: https://gist.github.com/sghiassy/e14593a439a03028b98a | |
##### OSX | |
.DS_Store | |
##### Xcode | |
build/ | |
*.pbxuser | |
!default.pbxuser | |
*.mode1v3 |
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
#!/bin/bash | |
#################################### | |
# Setup | |
#################################### | |
tmpfile="/vagrant/.capacitor/runonce" | |
if [ -e ${tmpfile} ]; then | |
echo "Provisioning already completed. Remove ${tmpfile} to run it again." |
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
// 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(); |
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; | |
} |