Skip to content

Instantly share code, notes, and snippets.

@SkothaSec
SkothaSec / SelectCountryState.js
Last active September 22, 2020 01:32
MaterialUI AutoSelect component for populated list of countries and dynamic state/region drop down list
DELETE ME - Must create a new gist with an initial file
import React, { useState, useEffect } from "react";
import TextField from "@material-ui/core/TextField";
import Autocomplete from "@material-ui/lab/Autocomplete";
import { countriesAndStates } from "./data/countriesAndStates";
const SelectCountry = () => {
const [country, setCountry] = useState(countriesAndStates[0].name);
@SkothaSec
SkothaSec / README.md
Created August 13, 2020 20:58
npx setup for reactma boiler

Reactma

Test setup with npx

@SkothaSec
SkothaSec / brokeds_lib_setup.md
Last active March 21, 2019 22:07
A decent npm install command to cover most things required for setting up npm modules for a webpack, babel, react, and sass project.

Broke Design NPM Dependencies Insallation

All Dependencies

npm i -D concurrently nodemon @babel/cli  @babel/preset-react     \
       @babel/preset-env babel-loader                             \
      @babel/plugin-proposal-class-properties                     \
      webpack webpack-cli webpack-dev-server                      \
      clean-webpack-plugin html-webpack-plugin                    \
      mini-css-extract-plugin interpolate-html-plugin             \
@SkothaSec
SkothaSec / react-scss.webpack.config.js
Last active March 21, 2019 23:54
Webpack Config for React and SCSS project.
const CleanWebpackPlugin = require('clean-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const InterpolateHtmlPlugin = require('interpolate-html-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const devMode = process.env.NODE_ENV !== 'production'
const path = require('path');
module.exports = {
entry: ['./src/index.js', './src/styles/scss/styles.scss'],
@SkothaSec
SkothaSec / shape_area.py
Created August 11, 2018 19:00
Code Signals shapeArea solution
from math import tan, pi
def shapeArea(n):
"""Find area of a polygon for given n
The example provided shows that area for:
n = 1 is 1 , n = 2 is 5, n = 3 is 13, n = 4 is 25.
or visually:
*
* ***
* *** *****
@SkothaSec
SkothaSec / adjacent_element_product.py
Created August 11, 2018 17:52
Solution for code signal's adjacentElementProduct arcade challenge
def adjacentElementsProduct(inputArray):
"""Given an array of integers, find and return the max product of 2 adjecent items in array"""
products = tuple(idx * idx_next for idx, idx_next in zip(inputArray, inputArray[1:])) # make tuple for multiplied adjecent array items
max_prod = None
for val in products: # Find highest value in products tuple, then return it
if max_prod == None or val > max_prod:
max_prod = val
return max_prod
@SkothaSec
SkothaSec / artist_and_position.py
Created August 3, 2018 19:44
solution for dataquest iterations and list comprehensions: doesn't show solve because of my format but returns lists for both artists and positions
""" Stats from csv
top100 columns = 'Track Name', 'Artist', 'Position', 'Streams'
top100 vals = str str int int
"""
import csv
def file_list(filename):
f = open(filename, "r")
lst_f = list(csv.reader(f))
wo_head_f = lst_f[1:]