Skip to content

Instantly share code, notes, and snippets.

View nnennajohn's full-sized avatar

Nnenna John nnennajohn

  • San Francisco, CA
View GitHub Profile
@nnennajohn
nnennajohn / generate-md-files.js
Created October 7, 2020 01:29 — forked from DavidWells/generate-md-files.js
Generate markdown files with faker.js
var faker = require('faker')
var fs = require('fs')
var path = require('path')
for (var i = 0; i < 1000; i++) {
generateMD()
}
function generateMD () {
var fileName = faker.lorem.word() + '-' + faker.lorem.word()
@nnennajohn
nnennajohn / nvmCommands.js
Last active August 1, 2020 01:31 — forked from chranderson/nvmCommands.js
Useful NVM commands
// check version
node -v || node --version
// list installed versions of node (via nvm)
nvm ls
// install specific version of node
nvm install 6.9.2
// set default version of node
@nnennajohn
nnennajohn / notion2blog.js
Created April 14, 2020 22:10 — forked from mayneyao/notion2blog.js
Notion.so > Personal Blog | custom domain + disqus comment
const MY_DOMAIN = "agodrich.com"
const START_PAGE = "https://www.notion.so/gatsby-starter-notion-2c5e3d685aa341088d4cd8daca52fcc2"
const DISQUS_SHORTNAME = "agodrich"
addEventListener('fetch', event => {
event.respondWith(fetchAndApply(event.request))
})
const corsHeaders = {
"Access-Control-Allow-Origin": "*",
@nnennajohn
nnennajohn / Update .gitignore
Created March 29, 2020 20:39 — forked from c33k/Update .gitignore
Updating .gitignore and cleaning the cache
//First commit any outstanding code changes, and then, run this command:
git rm -r --cached .
//This removes any changed files from the index(staging area), then just run:
git add .
//Commit
git commit -m "Atualizando .gitignore para..."
@nnennajohn
nnennajohn / reset.ts
Last active March 15, 2020 08:20
Reset Prisma2 records
import camelCase from 'lodash/camelCase';
import { prisma } from '@cpath/universal/shared/db';
import knexClient from './knex';
// Contents of the knexClient import above
// import Knex from 'knex';
// const knexClient: Knex = Knex({
// client: 'pg',
// connection: {
// user: process.env.POSTGRES_USER,
// password: process.env.POSTGRES_PASSWORD,
@nnennajohn
nnennajohn / download.js
Created August 3, 2019 10:56 — forked from gregbarcza/download.js
Download all image from cloudinary
'use strict'
const cloudinary = require('cloudinary')
const Promise = require('bluebird')
const co = require('co')
const fs = Promise.promisifyAll(require('fs'))
const request = require('request')
const moment = require('moment')
// FILL THIS
cloudinary.config({
cloud_name: '',
@nnennajohn
nnennajohn / eventemitter.js
Created July 9, 2019 22:55 — forked from mudge/eventemitter.js
A very simple EventEmitter in pure JavaScript (suitable for both node.js and browsers).
/* Polyfill indexOf. */
var indexOf;
if (typeof Array.prototype.indexOf === 'function') {
indexOf = function (haystack, needle) {
return haystack.indexOf(needle);
};
} else {
indexOf = function (haystack, needle) {
var i = 0, length = haystack.length, idx = -1, found = false;
@nnennajohn
nnennajohn / index.md
Created June 27, 2019 17:40 — forked from iamakulov/index.md
Webpack’s ContextReplacementPlugin examples
@nnennajohn
nnennajohn / RemoveUntrackedFiles.md
Last active April 5, 2019 12:46
Remove git untracked files

When you add something into a .gitignore file, try this:

  git add [uncommitted changes you want to keep] && git commit
  git rm -r --cached .
  git add .
  git commit -m "fixed untracked files"

If you remove something from a .gitignore file, and the above steps don't work, try this:

@nnennajohn
nnennajohn / deleteFiles
Created February 25, 2019 00:19
Delete all find ending with Path
// First list files that match to be sure
find . -name "*.spec.js" -type f
then
find . -name "*.spec.js" -type f -delete