Skip to content

Instantly share code, notes, and snippets.

Hugh Caluscusin MelodicCrypter

View GitHub Profile
@MelodicCrypter
MelodicCrypter / .eslintignore
Last active Apr 25, 2020
Starter settings for React with TypeScript, ESLint, Prettier, and Apollo. Also, GraphQL, Bulma and Webfont Loader are included.
View .eslintignore
# dependencies
/node_modules
# testing
/coverage
# production
build/*
build
@MelodicCrypter
MelodicCrypter / .eslintignore
Last active Mar 30, 2020
Common development setup for React => Babel, ESLint and Prettier (with or without Flow).
View .eslintignore
# dependencies
/node_modules
# testing
/coverage
# production
/build
# misc
@MelodicCrypter
MelodicCrypter / .babelrc
Last active Mar 10, 2020
Common development setup for NodeJS projects: Babel, ESLint, Prettier, etc.
View .babelrc
{
"presets": [
"@babel/preset-env"
]
}
@MelodicCrypter
MelodicCrypter / existing-repo.txt
Created Feb 14, 2020
Adding local repo to existing remote repository.
View existing-repo.txt
git remote add origin remote repository URL
git remote -v
git push -u origin master
@MelodicCrypter
MelodicCrypter / _app.js
Created Feb 13, 2020
Setting up ApolloClient and custom _app setting for NextJS.
View _app.js
import React from 'react';
import App from 'next/app';
import { ApolloProvider } from '@apollo/react-hooks';
// Bulma
import '../../public/sass/main.scss';
// Components and Utils
import withApollo from '../lib/withApollo';
@MelodicCrypter
MelodicCrypter / next.config.js
Last active Feb 13, 2020
Using Bulma, Sass and Image Optimization with NextJS configuration.
View next.config.js
const withPlugins = require('next-compose-plugins');
const optimizedImages = require('next-optimized-images');
const withSass = require('@zeit/next-sass');
const withCSS = require('@zeit/next-css');
const nextConfig = {
webpack(config, options) {
config.module.rules.push({
test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/,
use: {
@MelodicCrypter
MelodicCrypter / .eslintignore
Last active Feb 17, 2020
Common Dev Dependencies and Their Configurations (ESLint and Prettier). Check all four files inside this gist. TL-DR: yarn add -D babel-eslint babel-plugin-module-resolver eslint eslint-config-airbnb eslint-config-prettier eslint-plugin-import eslint-plugin-prettier eslint-plugin-react eslint-plugin-react-hooks gatsby-plugin-eslint eslint-loader…
View .eslintignore
node_modules
.next
@MelodicCrypter
MelodicCrypter / common.gitignore
Last active Dec 6, 2019
Common gitignore stuffs that I have already generated using GitIgnore.io API. Included are Git, Node, React, React Native, MacOS, Windows, WebStorm, PhpStorm, JetBrains, and SublimeText.
View common.gitignore
# Created by https://www.gitignore.io/api/git,node,react,macos,windows,webstorm,phpstorm,jetbrains,reactnative,sublimetext
# Edit at https://www.gitignore.io/?templates=git,node,react,macos,windows,webstorm,phpstorm,jetbrains,reactnative,sublimetext
### Git ###
# Created by git for backups. To disable backups in Git:
# $ git config --global mergetool.keepBackup false
*.orig
# Created by git when using merge tools for conflicts
*.BACKUP.*
@MelodicCrypter
MelodicCrypter / create-append-node.js
Created Aug 19, 2019
Two utilities that will create node and append node to that parent node you just created. I've seen these somewhere else so I just shared to you as well.
View create-append-node.js
// Utility for creating Nodes
export const createNode = element => {
return document.createElement(element);
};
// Utility for appending node to parent Node
export const appendNode = (parent, el) => {
return parent.appendChild(el);
};
@MelodicCrypter
MelodicCrypter / upload-stream-video.js
Created Aug 19, 2019
A NodeJS sample for uploading videos and then streaming the video with range feature. Multiparty is a NPM module for uploading file in Node.
View upload-stream-video.js
const { createServer } = require('http');
const { promisify } = require('util');
const multiparty = require('multiparty');
const {
stat,
createReadStream,
createWriteStream
} = require('fs');
const file = __dirname+'/powder-day.mp4';
You can’t perform that action at this time.