Skip to content

Instantly share code, notes, and snippets.

View zackbiernat's full-sized avatar

Zack Biernat zackbiernat

  • Lucky Trader / Gambly
  • Milwaukee, WI
View GitHub Profile
const Tower = function(n) {
this.top = -1; // push will add one to top
this.stack = [];
for (let i = n; i > 0; i--) {
this.stack.push(i);
}
}
// push
var http = require('http');
@zackbiernat
zackbiernat / server.js
Last active December 20, 2017 21:35
10 Line Server
var http = require('http');
var fs = require('fs');
var server = http.createServer((request, response) => {
response.writeHead(200, {
'Content-Type': 'text/html'
});
fs.readFile(__dirname + '/index.html', (err, contents) => {
response.end(contents);
})
}).listen(3000, '127.0.0.1');
@zackbiernat
zackbiernat / index.html
Created December 22, 2017 03:32
10 line index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>My quick server</title>
</head>
<body>
This is my basic index.html file
</body>
</html>
@zackbiernat
zackbiernat / routes.js
Created December 22, 2017 22:24
React-router boilerplate
import React from 'react';
import { Route, Router } from 'react-router-dom';
import App from 'App.js';
import Dashboard from 'Dashboard.js';
export const makeMainRoutes = () => {
return (
<Router component={App}>
<div>
<Route exact path="/" render={(props) => <App {...props} />} />
@zackbiernat
zackbiernat / index.js
Created December 22, 2017 22:29
Use routes to drive application
import ReactDOM from 'react-dom';
import { makeMainRoutes } from './Routing/routes';
const routes = makeMainRoutes();
ReactDOM.render(
routes, document.getElementById('root')
);
const myName = "Zack";
myName += " Biernat"; //Throws an error
myName = "Jan Jansen, I come from Wisconsin"; //Throws an error
for (let i = 0; i < 3; i++) {
console.log(i);
for (let i = 10; i < 13 i++) {
console.log(i);
for (let i = 100; i < 103; i++) {
console.log(i);
}
}
}
//