Skip to content

Instantly share code, notes, and snippets.

View pnegahdar's full-sized avatar

Parham Negahdar pnegahdar

View GitHub Profile

Keybase proof

I hereby claim:

  • I am pnegahdar on github.
  • I am pnegahdar (https://keybase.io/pnegahdar) on keybase.
  • I have a public key ASDjJQxGt1r4rvqmdRx_G472F2lZqkQLXbVoJHhSnTq8Dgo

To claim this, I am signing this object:

@pnegahdar
pnegahdar / contexDefaultProps.js
Created August 12, 2017 23:22
contexDefaultProps.js
import React from "react";
import PropTypes from "prop-types";
export function withContextDefaults(WrappedComponent) {
return class extends React.Component {
// Make sure context field contextName is in the child so it recieves the context
static contextTypes = {...WrappedComponent.contextTypes || {}, contextName: PropTypes.string}
componentWillMount() {
const contextDefaultProps = (WrappedComponent.contextDefaultProps && WrappedComponent.contextDefaultProps[this.context.contextName]) || {}
@pnegahdar
pnegahdar / contexDefaultProps.js
Created August 12, 2017 23:22
contexDefaultProps.js
import React from "react";
import PropTypes from "prop-types";
export function withContextDefaults(WrappedComponent) {
return class extends React.Component {
// Make sure context field contextName is in the child so it recieves the context
static contextTypes = {...WrappedComponent.contextTypes || {}, contextName: PropTypes.string}
componentWillMount() {
const contextDefaultProps = (WrappedComponent.contextDefaultProps && WrappedComponent.contextDefaultProps[this.context.contextName]) || {}
{
"metadata": {
"name": "Untitled0"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@pnegahdar
pnegahdar / Mongodb Upstart
Last active December 30, 2015 18:19 — forked from aaronlerch/README.md
MMS agent and Backup Agent upstart/service scripts.
## Download
Download and install the agent(s). These examples are on a standard 64-bit Amazon EC2 Linux AMI.
*MMS*
```
wget [path to mms agent download, specified by 10gen]
sudo tar xvzf 10gen-mms-agent-[CUSTOM_NAME].tar.gz -C /opt
```