This file contains hidden or 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
| String.prototype.padLeft = function(padding, passedChar) { | |
| if(passedChar === undefined) { | |
| passedChar = " "; | |
| } | |
| var specialChar = passedChar; | |
| var strLength = this.length; | |
| var padLength = padding - strLength; | |
This file contains hidden or 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
| // Use this to create a generic function that you can specialize later | |
| // This example takes only 1 argument | |
| function add(firstNumber) { | |
| //var addMe = firstNumber; | |
| return function(secondNumber) { | |
| return firstNumber + secondNumber; | |
| } | |
| } | |
| var twenty = add(12)(8); |
This file contains hidden or 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
| Array.prototype.max = function(){ | |
| return this.reduce(function(prev,curr) { | |
| return Math.max(prev,curr); | |
| }); | |
| } | |
| arr = [1,2,4,3,6,3,7,8,2]; | |
| console.log(arr.max()); |
This file contains hidden or 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
| numArr = [1,2,4,5,3,6,10,11,5,20,50,33,29]; | |
| sortAscending = numArr.sort(function(a,b) { | |
| return a - b; | |
| }); | |
| console.log(sortAscending); | |
| sortDescending = numArr.sort(function(a,b){ | |
| return b - a; |
This file contains hidden or 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 webpack = require('webpack') | |
| path = require('path'), | |
| ExtractTextPlugin = require("extract-text-webpack-plugin"), | |
| HTMLWebpackPlugin = require('html-webpack-plugin'), | |
| ExtractCSS = new ExtractTextPlugin("css/[name].[chunkhash].css"), | |
| CopyWebpackPlugin = require("copy-webpack-plugin"); | |
| module.exports = { | |
| entry: { | |
| vendor: [ |
This file contains hidden or 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
| { | |
| "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" | |
| }, |
This file contains hidden or 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
| server { | |
| root /var/www/Sites/jamesbuczkowski.com/public_html/dist; | |
| server_name jamesbuczkowski.com www.jamesbuczkowski.com; | |
| location / { | |
| try_files $uri /index.html; | |
| } | |
| } |
This file contains hidden or 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
| <html> | |
| <head> | |
| <script> | |
| // http://www.randomsnippets.com/2008/02/21/how-to-dynamically-add-form-elements-via-javascript/ | |
| var counter = 0; | |
| var limit = 10; | |
| function addNewGradeCheck(e, divName) { | |
| e.preventDefault(); |
This file contains hidden or 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'; | |
| class Welcome extends Component { | |
| constructor(props) { | |
| super(props); | |
| this.state = { message: 'Welcome to the Welcome Page!'}; | |
| } | |
| render() { | |
| return ( |
This file contains hidden or 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'; | |
| const ExampleComponent = ({message}) => { | |
| const showMessage = (event) => { | |
| alert(`The message is: ${message}`); | |
| }; | |
| return ( | |
| <div> | |
| <a href="#" onClick={showMessage}>show me</a> |
OlderNewer