Skip to content

Instantly share code, notes, and snippets.

var models = require('../models/models.js');
var express = require('express');
var router = express.Router();
/* GET users listing. */
const addFunc = (type, body, res) => {
console.log('inside the addFunc and type: ', type, ' and body: ', body)
if(type=='store'){
models.Store.find({name: body.store}, function (err, docs) {
var models = require('../models/models.js');
var express = require('express');
var router = express.Router();
/* GET users listing. */
const addFunc = (type, body, res) => {
console.log('inside the addFunc and type: ', type, ' and body: ', body)
if(type=='store'){
models.Store.find({name: body.store})
import react, {Component} from 'react';
import styles from '../../styles/molecules/content.module.css';
import buttonStyle from '../../styles/quarks/button.module.css';
import axios from 'axios';
class ContentCRUD extends Component{
state={
var models = require('../models/models.js');
var express = require('express');
var router = express.Router();
/* GET users listing. */
const addFunc = (type, body, res) => {
console.log('inside the addFunc and type: ', type, ' and body: ', body)
if(type=='store'){
models.Store.find({name: body.store})
import React, {Component} from 'react';
import {Elements, CardElement, ElementsConsumer, injectStripe, StripeProvider} from '@stripe/react-stripe-js';
import {loadStripe} from '@stripe/stripe-js';
import CheckoutForm from "./CheckoutForm";
const stripePromise = loadStripe('SECRET');
const createOptions = () => {
return {
style: {
listen 80 is in my default server so including it in my sites-available file will cause an error.
This file `myproject` in sites-available (and simlinked in sites-enabled) does not show my react app in `my/project/build`
which should load through the index.html file. It shows the welcome screen to nginx. Why is this? I thought this should
work as intended.
server {
server_name www.myproject.com myproject.com;
index index.html index.htm;
root /my/project/build;
//This works once, but the function returns the following error if called twice
// Os { code: 2, kind: NotFound, message: "No such file or directory" }
fn python_path() -> std::io::Result<(String)> {
let pathdir = PathBuf::from("./scripts");
let path = fs::canonicalize(&pathdir)?;
println!("value of path {:?}", path.as_path().display().to_string());
Ok((path.as_path().display().to_string()))
}
I'm using the following packaged (https://doc.rust-lang.org/std/process/struct.Command.html) to run bash scripts in rust
(here ss is an argument). It calls the below bash script. However it never reaches "after commnads has executed" even
though I have an exit statement in my bash file. Does anyone know why this might be or the solution? I've looked through
the commands documentation and nothing seems immediately apparent.
let output = Command::new("sh")
.arg("run_transcript.sh")
.arg(ss)
.spawn()
.expect("failed to execute process");
I'm getting the following error -
error[E0308]: mismatched types
--> src/commands/music.rs:112:119
|
112 | update_postgres(client, "UPDATE errata SET transcription = $1 WHERE foreign_key = $2", &[&string, &music.errata]);
| ^^^^^^^^^^^^^ expected struct `std::string::String`, found `i32`
The function I am calling is this:
@patientplatypus6
patientplatypus6 / errors.sh
Created October 10, 2020 14:40
pqxx not including
I've installed libpqxx on an ubuntu machine using the directions found here -
https://github.com/jtv/libpqxx/blob/master/BUILDING-configure.md
I've used the following commands (running the configure file at root and then making and the installing):
./configure
make
sudo make install
Then, in my C++ file, following directions I found here -
https://www.tutorialspoint.com/postgresql/postgresql_c_cpp.htm