Skip to content

Instantly share code, notes, and snippets.

View olarra's full-sized avatar

Jesus olarra

View GitHub Profile
@olarra
olarra / package.json
Created January 24, 2022 09:05 — forked from loganpowell/package.json
Simple pure npm scripts build process
{
"name": "project-name",
"description": "Template for static sites",
"version": "1.0.0",
"homepage": "http://www.project-name.com",
"author": {
"name": "Adam Reis",
"url": "http://adam.reis.nz"
},
"license": "UNLICENSED",
@olarra
olarra / gist:e58e15aca4bd7e687a68d839eae85782
Created April 8, 2021 21:12 — forked from davekiss/gist:9af08fde4ce2d40e306a35028583d6e5
Cognito's Complete New Password using Amplify + React
import React, { useState, useEffect } from "react";
import Auth from "@aws-amplify/auth";
import useNotification from "hooks/useNotification";
const URLSearchParams = require("url-search-params");
import { useHistory } from "react-router-dom";
const CompleteNewPassword = props => {
const history = useHistory();
@olarra
olarra / graphql.ts
Created February 19, 2021 13:59 — forked from mfellner/graphql.ts
Using Apollo Server in Next.js 9 with API route in pages/api/graphql.ts
import { ApolloServer, gql } from 'apollo-server-micro';
const typeDefs = gql`
type Query {
sayHello: String
}
`;
const resolvers = {
Query: {
@olarra
olarra / logger.js
Created January 16, 2021 11:57 — forked from leohxj/logger.js
custom logger
export const logger = (name, ...args) => {
if (process.env.NODE_ENV === 'development') {
// eslint-disable-next-line
console.groupCollapsed(`logger --> ${name}`);
// eslint-disable-next-line
console.log(...args);
// eslint-disable-next-line
console.groupEnd();
}
};
@olarra
olarra / SingletonModuleScopedInstance.js
Created June 11, 2020 09:11 — forked from dmnsgn/SingletonModuleScopedInstance.js
ES6 singleton pattern: constructor return an instance scoped to the module
// http://amanvirk.me/singleton-classes-in-es6/
let instance = null;
class SingletonModuleScopedInstance {
constructor() {
if (!instance) {
instance = this;
}
this._type = 'SingletonModuleScopedInstance';
@olarra
olarra / npm-using-https-for-git.sh
Created May 11, 2020 08:44 — forked from taoyuan/npm-using-https-for-git.sh
Force git to use https:// instead of git://
# npm using https for git
git config --global url."https://github.com/".insteadOf git@github.com:
git config --global url."https://".insteadOf git://
# npm using git for https
git config --global url."git@github.com:".insteadOf https://github.com/
git config --global url."git://".insteadOf https://
@olarra
olarra / service.js
Created May 2, 2020 10:53 — forked from paulsturgess/service.js
An example Service class wrapper for Axios
import axios from 'axios';
class Service {
constructor() {
let service = axios.create({
headers: {csrf: 'token'}
});
service.interceptors.response.use(this.handleSuccess, this.handleError);
this.service = service;
}
@olarra
olarra / request.js
Created October 6, 2019 15:14 — forked from sheharyarn/request.js
Axios Request Wrapper for React (https://to.shyr.io/axios-requests)
/**
* Axios Request Wrapper
* ---------------------
*
* @author Sheharyar Naseer (@sheharyarn)
* @license MIT
*
*/
import axios from 'axios'
├── actions
│ ├── comment.actions.js
│ └── post.actions.js
├── components
│ ├── comment
│ | ├── Comment.js
│ | ├── comment.css
│ | └── Comment.spec.js
│ ├── comments
│ | ├── Comments.js