Skip to content

Instantly share code, notes, and snippets.

View codyaverett's full-sized avatar
🎯
Focusing

Cody Averett codyaverett

🎯
Focusing
View GitHub Profile
const { createServer } = require('http');
createServer((req, res) => {
res.writeHead(200, {
Connection: 'Transfer-Encoding',
'Content-Type': 'text/html; charset=utf-8',
'Transfer-Encoding': 'chunked'
});
res.write(`
@codyaverett
codyaverett / README.md
Created August 29, 2019 01:21 — forked from phillipgreenii/README.md
Running NPM Scripts through maven

I am in the process of introducing single page applications to where I work. For development, using node based build tools is much easier for the single page applications. However, the build process for our organization is based upon maven. Our solution started with the maven plugin frontend-maven-plugin. It worked great at first, but then we ran into a situation that I couldn't make work with it.

As stated before, at our organization, we have the older ecosystem which is maven and the newer ecosystem which is node. Our goal was to keep the hacking to a minimum. We did this by putting all of the hacks into a single super node based build file. This is what maven calls and the reason frontend-maven-plugin wasn't sufficient. The super node based build script calls all of the other build scripts by spawning npm run. Try as I might, I could not figure out how to make the spawn work. front-end-maven-plugin downloads npm

import React from 'react';
import ReactParticles from 'react-particles-js';
import particlesConfig from './particles-config.js';
function Particles({ children }) {
return (
<div style={{ position: 'relative' }}>
<ReactParticles
params={particlesConfig}

For example, to override the AppBar (https://material-ui-next.com/api/app-bar/) root class we can do the following:

First method (override Material UI classnames):

1 - Add the property classes in the AppBar component:

    <AppBar classes={{root: 'my-root-class'}}
@codyaverett
codyaverett / gist:727790b6a04a6ec4f935639b6c4f7007
Created April 5, 2019 05:16 — forked from trongthanh/gist:2779392
How to move a folder from one repo to another
# source: http://st-on-it.blogspot.com/2010/01/how-to-move-folders-between-git.html
# First of all you need to have a clean clone of the source repository so we didn't screw the things up.
git clone git://server.com/my-repo1.git
# After that you need to do some preparations on the source repository, nuking all the entries except the folder you need to move. Use the following command
git filter-branch --subdirectory-filter your_dir -- -- all
# This will nuke all the other entries and their history, creating a clean git repository that contains only data and history from the directory you need. If you need to move several folders, you have to collect them in a single directory using the git mv command.

Development setup

  • create lerna monorepo
  • created strapi portal as package
  • create mainsite as package
  • add strapi data for plugin
  • look into strapi plugin implementation looks involved and too attached to the strapi stack
  • debug error (hook:bookshelf) takes too long to load removed the duplicate ID record packages/strapi-cms/api/intent/models/Intent.settings.json
@codyaverett
codyaverett / 3dWaves
Last active March 7, 2019 10:43
P5.js stuff from following along with Daniel Shiffman
let angle = 0;
let w = 10;
let ma;
function setup() {
createCanvas(400, 400, WEBGL);
ma = atan(1/sqrt(2));
}
@codyaverett
codyaverett / setup-browser-env.js
Created February 26, 2019 04:05
My Ava + Typescript + React Wallaby config
import browserEnv from 'browser-env';
// browserEnv();
browserEnv(['window', 'document', 'navigator']);
// Ensure Date is defined on window properly
// Strange issues with this https://github.com/TheBrainFamily/wait-for-expect/issues/12
window.Date = global.Date;
@codyaverett
codyaverett / .block
Created February 14, 2019 03:09 — forked from mbostock/.block
The Gist to Clone All Gists
license: gpl-3.0
# Force Proxy settings in Node process - https://github.com/burka/npm/commit/0da12c29c43452c8c6f092003987ffc2dd57a8b3
In npmjs add
//HACK
if (npm.config.get('http-proxy') && !process.env['HTTP_PROXY'])
{
process.env['HTTP_PROXY'] = npm.config.get('http-proxy')
}