Skip to content

Instantly share code, notes, and snippets.

React PropTypes Intellisense - Visual Studio Marketplace

ES7 React/Redux/GraphQL snippets - Visual Studio Marketplace rccp boilerplates a class Component with Proptypes exports and imports, their snippets are really good and customizable

EditorConfig for VS Code - Visual Studio Marketplace if you are working with teammates who use vscode and are using prettier or eslint I stroooonnngggly recommend adding a .editorconfig to the root of your project

Auto Rename Tag - Visual Studio Marketplace Auto Close Tag - Visual Studio Marketplace

// npm install --save-dev webpack-bundle-analyzer
process.env.NODE_ENV = "production"
var BundleAnalyzerPlugin = require("webpack-bundle-analyzer")
.BundleAnalyzerPlugin
const webpackConfigProd = require("react-scripts/config/webpack.config.prod")
webpackConfigProd.plugins.push(
new BundleAnalyzerPlugin({
@rrichardsonv
rrichardsonv / consoleUtils.js
Last active November 30, 2018 21:54
Github Console Scripts and Utils
function githubCollapseAll(){
const buttons = document.getElementsByTagName('button');
let results = [];
for(let i = 0, j = buttons.length; i<j; i++) {
let button = buttons[i]['attributes']['aria-label']
if(button && button['value'] === "Toggle diff contents"){
buttons[i].click();
}
}
}
@rrichardsonv
rrichardsonv / tries.js
Created May 2, 2018 22:09
Tries solution
class Node {
constructor(){
this.trie = {};
}
static traverseChildren(word, node){
if(!Object.keys(node).length){
return word;
}
return Object.keys(node)
@rrichardsonv
rrichardsonv / maze.js
Created April 27, 2018 22:34
MazeGeneration(might as well be stream of consciousness haha)
// create a function that accepts two paraments: an empty maze and a starting coordinate
// the maze will be an array of arrays of objects. the objects will look like:
// {
// "n": true,
// "e": true,
// "s": true,
// "w": true,
// "visited": false
// }
//
const preorderTraverse = (node) => {
if(!node){
return [];
}
return [node.value, ...preorderTraverse(node.left), ...preorderTraverse(node.right)];
};
const inorderTraverse = (node) => {
if(!node){
return [];
class BloomFilter {
static DEFAULT_HASH_FN(size) {
return (hex) => {
const hex32 = XXH.h32(hex);
return (string) => {
return Math.abs(hex32.update(string).digest().toNumber() % size);
};
};
}
/* body{
background: linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet) !important;
}
p, span, h1, h2, h3, h4, h5, div, section, article, body {
font-family: "Comic Sans MS", cursive, sans-serif !important;
}
.member_image{
-webkit-animation: spinToWin 5s infinite;
animation: spinToWin 5s infinite;
/*
Copyright 2017 Bryan Keller (https://github.com/widget-)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
{"latitude":37.8267,"longitude":-122.4233,"timezone":"America/Los_Angeles","offset":-7,"currently":{"time":1493401688,"summary":"Clear","icon":"clear-day","nearestStormDistance":290,"nearestStormBearing":63,"precipIntensity":0,"precipProbability":0,"temperature":63.04,"apparentTemperature":63.04,"dewPoint":44.49,"humidity":0.51,"windSpeed":8.04,"windBearing":339,"visibility":10,"cloudCover":0.17,"pressure":1018.03,"ozone":299.31},"minutely":{"summary":"Clear for the hour.","icon":"clear-day","data":[{"time":1493401680,"precipIntensity":0,"precipProbability":0},{"time":1493401740,"precipIntensity":0,"precipProbability":0},{"time":1493401800,"precipIntensity":0,"precipProbability":0},{"time":1493401860,"precipIntensity":0,"precipProbability":0},{"time":1493401920,"precipIntensity":0,"precipProbability":0},{"time":1493401980,"precipIntensity":0,"precipProbability":0},{"time":1493402040,"precipIntensity":0,"precipProbability":0},{"time":1493402100,"precipIntensity":0,"precipProbability":0},{"time":1493402160,"pre