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
| mkdir dynamic-js-site-seo && cd dynamic-js-site-seo | |
| init -y | |
| npm install express | |
| mkdir 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
| const gSheetUrl = 'Copy & paste your Google Sheet URL here'; | |
| const gFormUrl = 'Copy & paste your Google Form URL here'; | |
| function updateFormBySheetData() { | |
| // Open the Google Sheet | |
| let gSheet = SpreadsheetApp.openByUrl(gSheetUrl).getSheetByName('Products'); | |
| // Get the product cells data | |
| let products = gSheet.getRange(2, 1, gSheet.getLastRow() - 1, 2).getValues(); | |
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
| ! version = 2.0 | |
| // Substitution | |
| ! sub users = user | |
| ! sub registered = register | |
| // Triggers | |
| + how many user register today | |
| - <call>subUserRegisterToday</call> | |
| + block user # | |
| - <call>subBlockUser <star></call> | |
| + * |
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 assert = require('assert'); | |
| const MongoClient = require('mongodb').MongoClient; | |
| const mongoUrl = 'mongodb://localhost:27017/mydb'; | |
| const RiveScript = require('rivescript'); | |
| class RsHandler { | |
| constructor() { | |
| this._rs = new RiveScript({ utf8: 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
| const MongoClient = require('mongodb').MongoClient; | |
| const mongoUrl = 'mongodb://localhost:27017/demo'; | |
| async function main() { | |
| let dbc = await MongoClient.connect(mongoUrl, { useNewUrlParser: true }); | |
| let db = dbc.db('demo'); // Create a demo database | |
| let colUsers = await db.createCollection('users'); | |
| // Delete all records at the beginning |
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 express = require('express'); | |
| const bodyParser = require('body-parser'); | |
| const app = express(); | |
| const port = 3000; | |
| const { WebClient } = require('@slack/web-api'); | |
| const MongoClient = require('mongodb').MongoClient; | |
| const mongoUrl = 'mongodb://localhost:27017/mydb'; | |
| const CONFIG = require('./config.json') | |
| const RsHandler = require('./rivescripthandlers'); |
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
| { | |
| "name": "slack-app-backend-admin", | |
| "version": "1.0.0", | |
| "description": "An intelligent Slack bot to simplify website administration", | |
| "main": "app.js", | |
| "scripts": { | |
| "start": "node app", | |
| "initdb": "node initdb.js" | |
| }, | |
| "repository": { |
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 unlockWalletRestApi() { | |
| // Make a POST request with a JSON payload. | |
| var options = { | |
| 'method': 'post', | |
| 'payload': '' | |
| }; | |
| UrlFetchApp.fetch('http://demo.simonho.net:5000/api/unlock_wallet', options); | |
| } | |
| function createAccountRestApi() { |
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 _account; | |
| ///////////////////////////////////////////// | |
| // Internal Functions | |
| ///////////////////////////////////////////// | |
| // Call server-side script unlockWalletRestApi() | |
| function callServerUnlockWallet_(callback) { | |
| var status = app.pages.ElectionPage.descendants.ConnectionStatus; // the status label | |
| google.script.run.withFailureHandler(function(error) { |
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 subprocess | |
| from flask import Flask | |
| from flask import render_template | |
| ... | |
| def cleos(args): | |
| if isinstance(args, list): | |
| command = ['cleos', '--wallet-url=http://localhost:8899'] | |
| command.extend(args) | |
| command = ' '.join(command) | |
| else: |
NewerOlder