Skip to content

Instantly share code, notes, and snippets.

View sovietspy2's full-sized avatar
💩
will code for food

Barney Dono sovietspy2

💩
will code for food
View GitHub Profile
@sovietspy2
sovietspy2 / nodejs project strucure
Last active December 30, 2018 19:32
nodejs project strucure
Structure
app.js: main file, houses the embedded server and application logic
/public: contains static files to be served by the embedded server
/routes: houses custom routing for the REST API servers (not needed for a web app)
/routes/users.js: endpoint/routes for resources such as users
/views: contains templates that can be processed by a template engine (not needed for REST APIs)
/package.json: project manifest
/www: boot up script folder
@sovietspy2
sovietspy2 / server.js
Created December 31, 2018 08:27
simple express example routing
//server.js
const express = require('express');
const bodyParser = require('body-parser');
const errorHandler = require('errorhandler');
const morgan = require('morgan');
const routes = require('./routes');
let app = express();
app.use(bodyParser.json()); // support json encoded bodies
@sovietspy2
sovietspy2 / gist:65febb76a90237b1414e5df6a7be2267
Created January 11, 2019 09:13
Front end learning resources
Html css:
https://scrimba.com/@perborgen - CSS GRID , felxbox others
https://scrimba.com/g/gintrotocss - basic css
https://www.quora.com/Do-we-put-the-footer-inside-body
https://developer.mozilla.org/en-US/docs/Learn/HTML/Introduction_to_HTML/Document_and_website_structure
create table
listing (
id varchar(255) not null PRIMARY KEY,
currency varchar(3) not null,
description varchar(255) not null,
listing_price integer,
listing_status Integer NOT NULL,
location_id varchar(255) not null,
marketplace integer not null,
title varchar(255) not null,
@sovietspy2
sovietspy2 / js
Created February 11, 2019 16:31
JAVASCRIPT GET CURRENT UTC TIME
var nowUtc = new Date( new Date().getTime() + (new Date().getTimezoneOffset() * 60000));
upstream api_server {
server app.company:1234;
}
server {
listen 80;
server_name app.my.client.com;
root /home/sovietspy2/www/app;
@sovietspy2
sovietspy2 / gist:6c44ba3ff01e08e1f7c275cf65a0d1f7
Last active February 13, 2019 11:27
EXPRESS BACKEND RUNNING ON LOCALHOST:1234 REACT FRONTEND SERVED ON PORT 80 BY NGINX
upstream api_server {
server app.company:1234;
}
server {
listen 80;
server_name app.my.client.com;
root /home/sovietspy2/www/app;
@sovietspy2
sovietspy2 / index.js
Created February 19, 2019 13:30
Now v2 local dev for Node.js
require("dotenv-safe").config();
const url = require("url");
const now = require("./now.json");
const routes = now.routes
.filter(route =>
now.builds.some(
build =>
build.src.startsWith(`${route.dest.substring(1)}/`) &&
@sovietspy2
sovietspy2 / html5.html
Created March 25, 2019 09:18
the best of html5
<header>
<h1>Super duper best blog ever</h1>
<nav>
<a href="/">Home</a>
<a href="/about">About</a>
<a href="/archive">Archive</a>
</nav>
</header>
<main>
<article>