var GithubGist = user => async (hash, evalResult = true) => { const now = new Date(); const uri = `https://gist.githubusercontent.com/${user}/${hash}/raw?v=${now}`; const client = new HttpClient(); const response = await client.GetStringAsync(uri); const source = response.Result; if (evalResult) { eval(source) } else { return `${source}` } } // // https://gist.github.com/kevinkhill/d88cfad2e9b8578ba046cfcf6f803f47 // (async () => { const gist = GithubGist("kevinkhill"); try { const script = await gist("d88cfad2e9b8578ba046cfcf6f803f47", false); sp.MessageBox(script, "Remote Script Source"); sp.MessageBox( "This is just a POC, so if you want to eval a remote script...\n"+ "...THIS IS DANGEROUS BTW...\nRemove `false` from the method call :)", "THAR MIGHT BE DRAGONS!" ); } catch (err) { sp.MessageBox(`${err}`, "Oops!"); } })();