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
| const path = require('path'); | |
| process.chdir(path.join(__dirname, '..')); | |
| const fs = require('fs'); | |
| const child_process = require('child_process'); | |
| // replace with your own paths | |
| // you can find the command for the nginxExe by running "which nginx" in the terminal | |
| const nginxExe = '/usr/local/bin/nginx'; | |
| const mimeTypes = '/usr/local/etc/nginx/mime.types'; |
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
| server { | |
| listen 80; | |
| server_name mydomain.com; | |
| return 301 https://$host$request_uri; | |
| } | |
| server { | |
| listen 443 ssl http2; |
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
| async function getMSGraphAccessToken() { | |
| var body = { | |
| grant_type: 'client_credentials', | |
| client_id: process.env.AZURE_APP_ID, | |
| client_secret: process.env.AZURE_APP_SECRET, | |
| resource: 'https://graph.microsoft.com' | |
| }; | |
| var responseText = await request('https://login.windows.net/' + process.env.AZURE_TENANT_ID + '/oauth2/token', { method: 'POST', body, format: 'urlencoded' }); |
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
| module.exports = function (azureContext, req) { | |
| if (req.query.validationtoken) { | |
| azureContext.log('Validation token received: ' + req.query.validationtoken); | |
| azureContext.res = { | |
| body: req.query.validationtoken, | |
| isRaw: true | |
| }; | |
| azureContext.done(); | |
| return; |
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 csomapi = require("csom-node"); | |
| // this is an example of Azure Function that connects to SharePoint via JSOM | |
| module.exports = function (azureContext, req) { | |
| var web; | |
| initializeJSOM() | |
| .then(ctx => { | |
| web = ctx.get_web(); | |
| ctx.load(web); |
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 fileRelativeUrl = "Shared%20Documents/book1.xlsx"; | |
| var sheetName = "Sheet1"; | |
| var range = "A1|J45"; | |
| var url = _spPageContextInfo.webServerRelativeUrl.replace(/\/$/, '') + "/"; | |
| loadXMLDoc(url + "_vti_bin/ExcelRest.aspx/" + fileRelativeUrl + "/model/Ranges('" + sheetName + "!" + range + "')?$format=atom", function (text) { | |
| var parser = new DOMParser(); | |
| var excelRestNS = 'http://schemas.microsoft.com/office/2008/07/excelservices/rest'; | |
| var xmlDoc = parser.parseFromString(text, "text/xml"); | |
| var rows = xmlDoc.getElementsByTagNameNS(excelRestNS, 'row'); |
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
| <html> | |
| <head> | |
| <meta charset="utf8"/> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.15.2/codemirror.min.css"> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.15.2/codemirror.min.js"></script> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.15.2/mode/javascript/javascript.min.js"></script> | |
| </head> | |
| <body> | |
| <canvas width="200" height="240"></canvas> | |
| <div style="position: absolute; left: 250px; top: 20px; bottom: 0px; right: 0px;"> |
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
| <html> | |
| <body> | |
| <!-- utility libraries used by Angular 2 --> | |
| <script src="https://npmcdn.com/zone.js/dist/zone.js"></script> | |
| <script src="https://npmcdn.com/reflect-metadata/Reflect.js"></script> | |
| <script src="https://npmcdn.com/rxjs/bundles/Rx.umd.js"></script> | |
| <!-- Angular 2 bundles --> | |
| <script src="https://npmcdn.com/@angular/core/bundles/core.umd.js"></script> |
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
| import * as ts from 'typescript'; // don't forget to "npm install typescript -g && npm link typescript" | |
| var codeToAnalyse = ` | |
| function f1() {} | |
| var x = 10; | |
| function hello() { function hmm() {} } | |
| `; | |
| var source = ts.createSourceFile("test.ts", codeToAnalyse, ts.ScriptTarget.ES5); |