Let's say you want to host domains first.com and second.com.
Create folders for their files:
| from subprocess import run | |
| import os | |
| import json | |
| from datetime import datetime | |
| # path to input JSON | |
| in_path = os.path.join(os.environ['HOME'], 'Downloads/notes/source/notes.json') | |
| # path to output directory. it must exist. | |
| out_path = os.path.join(os.environ['HOME'], 'Downloads/for-bear') |
| import express from "express"; | |
| import { renderToString } from "react-dom/server"; | |
| import { StaticRouter } from "react-router-dom"; | |
| import routes from "./routes"; | |
| const app = express(); | |
| app.use((req, res) => { | |
| const context = {}; |
| // Example of usage | |
| import { selectors } from './rootReducer'; | |
| import { selectors } from '../../reducers/rootReducer'; | |
| const mapStateToProps = (state: State, ownProps: any) => ({ | |
| theseObjects: selectors.getTheseObjects(state), | |
| thoseObjects: selectors.getThoseObjects(state), | |
| showSomethinginUi: selectors.getSomethingFromUiSelectors(state), |
| import { render, unmountComponentAtNode } from 'react-dom'; | |
| export function renderText(component) { | |
| const _el = document.createElement('div'); | |
| document.body.appendChild(_el); | |
| render(component, _el); | |
| const text = _el.innerText; | |
| unmountComponentAtNode(_el); | |
| document.body.removeChild(_el); | |
| return text; |
| # http://stackoverflow.com/questions/1388025/how-to-get-id-of-the-last-updated-row-in-mysql | |
| # single row update | |
| SET @update_id := 0; | |
| UPDATE some_table SET column_name = 'value', id = (SELECT @update_id := id) | |
| WHERE some_other_column = 'blah' LIMIT 1; | |
| SELECT @update_id; | |
| # Multiple rows updated | |
| SET @uids := null; |
| { | |
| "keys": ["tab"], | |
| "command": "expand_abbreviation_by_tab", | |
| // put comma-separated syntax selectors for which | |
| // you want to expandEmmet abbreviations into "operand" key | |
| // instead of SCOPE_SELECTOR. | |
| // Examples: source.js, text.html - source | |
| "context": [ | |
| { |
| // the main app file | |
| import express from "express"; | |
| import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db) | |
| import authenticate from "./authentication"; // middleware for doing authentication | |
| import permit from "./authorization"; // middleware for checking if user's role is permitted to make request | |
| const app = express(), | |
| api = express.Router(); | |
| // first middleware will setup db connection |
| const Promise = require('bluebird'); | |
| const React = require('react'); | |
| const superagent = require('superagent'); | |
| const assign = require('lodash/object/assign'); | |
| const isArray = require('lodash/lang/isArray'); | |
| const isFunction = require('lodash/lang/isFunction'); | |
| const isObject = require('lodash/lang/isArray'); | |
| const isString = require('lodash/lang/isString'); | |
| const log = require('debug')('component:await'); |
| import { Component } from "React"; | |
| export var Enhance = ComposedComponent => class extends Component { | |
| constructor() { | |
| this.state = { data: null }; | |
| } | |
| componentDidMount() { | |
| this.setState({ data: 'Hello' }); | |
| } | |
| render() { |