Skip to content

Instantly share code, notes, and snippets.

View purnimagupta's full-sized avatar
🏠
Working from home

Purnima purnimagupta

🏠
Working from home
View GitHub Profile
@imCorfitz
imCorfitz / Auth.js
Created June 14, 2021 11:27
Strapi Refresh Token
// extensions/users-permissions/controllers/Auth.js
"use strict";
/**
* Auth.js controller
*
* @description: A set of functions called "actions" for managing `Auth`.
*/
/* eslint-disable no-useless-escape */
//Overridden strapi article controller file
'use strict';
//Controllers
const { parseMultipartData, sanitizeEntity } = require('strapi-utils');
/**
* Read the documentation (https://strapi.io/documentation/3.0.0-beta.x/concepts/controllers.html#core-controllers)
* to customize this controller
*/
@vsemozhetbyt
vsemozhetbyt / page-evaluateHandle-example.js
Last active February 5, 2020 19:59
page.evaluateHandle() example
'use strict';
const puppeteer = require('puppeteer');
(async function main() {
try {
const browser = await puppeteer.launch();
const [page] = await browser.pages();
await page.goto('https://example.org/');
@gaearon
gaearon / npm_init_error.md
Created June 28, 2018 00:53
What to do when npm init -y fails

If you get an "Invalid name" error when you run npm init -y, rename the project folder to only contain lowercase ASCII letters or hyphens (e.g. my-project), and try again.

@gaearon
gaearon / index.html
Last active March 10, 2025 04:43
Multiple React components on a single HTML page
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Add React in One Minute</title>
</head>
<body>
<h2>Add React in One Minute</h2>
<p>This page demonstrates using React with no build tooling.</p>
@andrhamm
andrhamm / callbacks.js
Last active April 27, 2022 17:01
Paginating Scans & Queries in DynamoDB with Node.js using Callbacks OR Promises
const AWS = require('aws-sdk');
AWS.config.logger = console;
const dynamodb = new AWS.DynamoDB({ apiVersion: '2012-08-10' });
let val = 'some value';
let params = {
TableName: "MyTable",
ExpressionAttributeValues: {
import React, { Component } from "react";
import "./App.css";
import { Route, Switch, Router } from "react-router-dom";
import Header from "../src/components/header/header";
import SideBar from "../src/components/sidebar/sidebar";
import Login from "./components/login/login.js";
import Dashboard from "./components/dashboard/dashboard";
import RequireAuth from "./components/utility/require-auth";
import history from "./components/utility/history";
@slavafomin
slavafomin / nodejs-custom-es6-errors.md
Last active May 12, 2025 03:50
Custom ES6 errors in Node.js

Here's how you could create custom error classes in Node.js using latest ES6 / ES2015 syntax.

I've tried to make it as lean and unobtrusive as possible.

Defining our own base class for errors

errors/AppError.js

@staltz
staltz / introrx.md
Last active May 15, 2025 10:37
The introduction to Reactive Programming you've been missing
#create a test index with shingle mapping
curl -XPUT localhost:9200/test -d '{
"settings":{
"index":{
"analysis":{
"analyzer":{
"analyzer_shingle":{
"tokenizer":"standard",
"filter":["standard", "lowercase", "filter_stop", "filter_shingle"]
}