Skip to content

Instantly share code, notes, and snippets.

import { Router } from "express"
import ejwt from "express-jwt"
import config from "config"
import createError from "http-errors"
import publicRouter from "./public"
import protectedRouter from "./protected"
console.log(protectedRouter)
const router = Router()
-- INSERT
INSERT INTO tablename (column1, column2, column3)
VALUES
('value1', 'value2', 'value3'),
('value4', 'value5', 'value6');
-- UPDATE
UPDATE tablename
SET
column1 = 'value1'
#!/bin/bash
NC='\033[0m' # No color
BLACK='\033[00;30'
RED='\033[0;31m'
GREEN='\033[0;32m'
ORANGE='\033[0;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
CYAN='\033[0;36m'
LIGHTGRAY='\033[0;37m'
var I = (function(){
var events = {}
function subscribe(event, fn) {
if (events.hasOwnProperty(event)) {
events[event].push(fn)
} else {
events[event] = [fn]
}
}
const gulp = require('gulp')
const buildCSS = require('./semantic/gulpfile').buildCSS
const fs = require('fs')
const varfiles = fs.readdirSync('files')
gulp.task('build-css', function build(done){
run()
})
import React, { Component } from 'react'
import { Route, Redirect } from 'react-router-dom'
import AuthService from '../lib/auth'
export const api = new AuthService()
const AuthContext = React.createContext({
isAuthenticated: false,
redirectUrl: '/login',
defaultRedirect: '/'
import React from 'react'
import { BrowserRouter as Router, Route, Link, Redirect } from 'react-router-dom'
import { Authentication, AuthRoute } from './Authentication'
import Login from './Login'
import Public from './Public'
import Protected from './Protected'
const App = props => (
<Router>
<Authentication
@overthemike
overthemike / responsivereact.js
Created December 15, 2017 03:25
responsivereact.js
import React, {Component} from 'react'
import ReactDOM from 'react-dom'
import App from './components/App'
import Mobile from './components/Mobile'
class Main extends Component {
state = {
width: window.innerWidth
}
// THIS IS OUR SERVER CODE SNIPPET
// this is the api call on our express server
// it's job is to take a call from our frontend
// and call another api when it's called and return
// that data back to the frontend
router.get('/mycall', function(req,res,nex){
request.get('http://someotherdomain.com/api/a/call/to/make', function(error, response, body){
// notice the difference between res and response
// now we respond back to our frontend with the
// data from the other domain's api
/* Color palette */
:root {
--black: #333333;
--greyish-brown: #565656;
--lightgrey: #f0f0f0;
--punchcodegreen: #7eff83;
--light-grey: #dcdedc;
--white: #ffffff;
--error: #ff0043;
--darkest: #1e1b1c;