Skip to content

Instantly share code, notes, and snippets.

View jslnriot's full-sized avatar

James Buczkowski jslnriot

View GitHub Profile
import { getHTML, getAmazonPrice } from './scrape';
const productURL = `https://www.amazon.ca/Vitamix-Explorian-Professional-Grade-Low-Profile-Refurbished/dp/B07CXVSMZ4/ref=sr_1_5?keywords=vitamix&qid=1555870204&s=gateway&sr=8-5&th=1`;
async function scrapePage() {
const html = await getHTML(productURL);
const amazonPrice = await getAmazonPrice(html);
console.log(`The price is ${amazonPrice}`);
}
@jslnriot
jslnriot / package.json-webpack2-example
Last active September 11, 2017 17:50
Package.json example for webpack 2 config
{
"name": "react-webpack2-bootstrap4-sass",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"clean": "rimraf dist",
"buildDev": "npm run build && ./node_modules/.bin/webpack-dev-server",
"build": "npm run clean && webpack"
},
const express = require('express');
// Passport
const passport = require('passport');
const GoogleStrategy = require('passport-google-oauth20').Strategy;
const keys = require('./config/keys');
const app = express();
function createStore(reducer, initialState) {
let state = initialState;
// Setup listners to keep track of when the state is changed
// to triger rerenders (observer pattern)
const listeners = [];
const subscribe = (listener) => (
listeners.push(listener)
);
class MessageInput extends React.Component {
state = {
value: '',
}
onChange = (e) => {
this.setState({
value: e.target.value,
})
};
{
"name": "SpinMyVinylServer",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node server.js",
"test": "export NODE_ENV=test || SET \"NODE_ENV=test\" && mocha ./**/*.test.js",
"test-watch": "nodemon --exec 'npm test'"
},
const argumentList = process.argv;
const addThese = argumentList.slice(2,argumentList.length);
let sum = 0;
let solution = addThese.forEach((value) => {
// convert to a number
sum += Number(value);
return sum;
});
// ----
// Sass (v3.4.7)
// Compass (v1.0.1)
// ----
$Color1: navy; // named color value
$Color2: #333333; // hex color value
$StringVar: " with Sass"; // string variable
$FontSize: 18px; // numeric value
$border: 1px solid $Color2; // multi-value variable
.container {
width: 960px;
margin: 0 auto;
padding: 15px 15px 15px 15px;
color: #333333;
}
.container h1 {
font-size: 54px;
color: navy;
border: 1px solid #333333;
.container {
width: 960px;
margin: 0 auto;
border: 1px solid navy;
padding: 15px 15px 15px 15px;
color: #333333;
}
.container h1 {
text-align: center;
border: 1px solid navy;