This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- INSERT | |
INSERT INTO tablename (column1, column2, column3) | |
VALUES | |
('value1', 'value2', 'value3'), | |
('value4', 'value5', 'value6'); | |
-- UPDATE | |
UPDATE tablename | |
SET | |
column1 = 'value1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// At a glance you can see which global objects are being imported, these are the local variable names you will use in your script | |
(function(z, $) { // encapsulate in a closure | |
// Use strict is within scoped function so that it only applies to this code block | |
"use strict"; // Prevents common errors and bad practices, by catching them at runtime. | |
var proto; // The var that will store the reference to the prototype for our widget | |
/** | |
* Description of what the widget does | |
* | |
* @example | |
* z.myWidget({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var I = (function(){ | |
var events = {} | |
function subscribe(event, fn) { | |
if (events.hasOwnProperty(event)) { | |
events[event].push(fn) | |
} else { | |
events[event] = [fn] | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: '/' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
NewerOlder