Skip to content

Instantly share code, notes, and snippets.

@prashantagarwal
prashantagarwal / ReuseRequest.js
Last active February 16, 2024 19:20
Script to fetch and reuse a request from a different collection
function executeReferencedRequest({ collectionUId, requestUId, requestName, apiKey }, callback) {
var _ = require('lodash');
let message;
if (!apiKey) {
message = "Pleas generate an API key and add it in your collection level variables"
}
if (!collectionUId) {
message = "Please enter the UId of the collection from which you want to resuse a request or script"
// I have stored the generated Mock URL as Collection Variable
let snapshotURL = pm.variables.get('snapshotURL'),
/* Create the path that was used in actual request. We will send it along with our Mock endpoint */
path = pm.request.url.path.join('/');
/* If request contains any query params then pass those as well to mock endpoint */
if (pm.request.url.query.count()) {
let params = pm.request.url.query.map((q) => {
// I have stored the generated Mock URL as Collection Variable
let snapshotURL = pm.variables.get('snapshotURL'),
/* Create the path that was used in actual request. We will send it along with our Mock endpoint */
path = pm.request.url.path.join('/');
/* If request contains any query params then pass those as well to mock endpoint */
if (pm.request.url.query.count()) {
let params = pm.request.url.query.map((q) => {
import Reconciler from 'react-reconciler'
import omit from 'lodash/omit'
import capitalize from 'lodash/capitalize'
import { actions as elementActions } from './store/elements'
import * as Elements from './elements'
const roots = new Map()
const emptyObject = {}
const Renderer = Reconciler({
@prashantagarwal
prashantagarwal / iterm2-solarized.md
Created November 30, 2016 17:27 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font (OS X / macOS)

Solarized

@prashantagarwal
prashantagarwal / decribe.js
Created September 20, 2016 07:30 — forked from MicheleBertoli/decribe.js
If all you have is a hammer, everything looks like a <Nail />
import React, { PropTypes } from 'react'
const Describe = ({ title, children }) => (
<div>
<h1>{title}</h1>
<ul>{children}</ul>
</div>
)
Describe.propTypes = {
@prashantagarwal
prashantagarwal / what-forces-layout.md
Created June 12, 2016 07:25 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@prashantagarwal
prashantagarwal / readme.md
Created November 30, 2015 07:55 — forked from coolaj86/how-to-publish-to-npm.md
How to publish packages to NPM

Getting Started with NPM (as a developer)

If you haven't already set your NPM author info, now you should:

npm set init.author.name "Your Name"
npm set init.author.email "you@example.com"
npm set init.author.url "http://yourblog.com"

npm adduser

Introduction

Author: Ari Lerner.

AngularJS offers a single framework that can be used to build dynamic, client-centric applications. It provides:

  • Module support
  • DOM manipulation
  • Animations
  • Templating