Skip to content

Instantly share code, notes, and snippets.

View simonho288's full-sized avatar
🏠
Working from home

Simon Ho simonho288

🏠
Working from home
View GitHub Profile
mkdir dynamic-js-site-seo && cd dynamic-js-site-seo
init -y
npm install express
mkdir public
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();
! 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>
+ *
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 });
}
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
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');
{
"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": {
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() {
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) {
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: