Skip to content

Instantly share code, notes, and snippets.

View meetzaveri's full-sized avatar

Meet Zaveri meetzaveri

View GitHub Profile

Helper Functions

ObjectToArray

function objectToArray(obj) {
  var keys = Object.keys(obj);
  var routeGeoJSON = keys.map(function(key) {
    return obj[key];
 });

Add-ons and config vars If an add-on is created for an application, it will typically create one or more config vars for that application. These config vars may be updated by the add-on - the exact values can change if the add-on service provider needs to change them.

See Add-on values can change to learn more about add-ons and how config vars are used.

Limits Config var data (the collection of all keys and values) is limited to 32kb for each app. Config var names should not begin with a double underscore (__). The HEROKU_ namespace is reserved for config vars set by the Heroku platform in order to offer functionality. Example

Script for .zip build

Paste this into package.json in scripts tag

"build": "zip -r listuserLambda.zip * -x *.zip"

@meetzaveri
meetzaveri / reactFileUpload.md
Last active March 15, 2021 16:32
File upload snippet for react
import React from "react";
import ReactDOM from "react-dom";

import "./styles.css";

class FileInput extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
def depth_first_search_recursive(graph, start, visited=None):
if visited is None:
visited = set()
visited.add(start)
for next in graph[start] - visited:
depth_first_search_recursive(graph, next, visited)
return visited
import collections
def bfs(graph, root):
visited, queue = set(), collections.deque([root])
visited.add(root)
while queue:
vertex = queue.popleft()
for neighbour in graph[vertex]:
if neighbour not in visited:
visited.add(neighbour)

Auth Wrapper for react :

withAuth.js

import React from 'react';
import {routes} from '../app/routes';

export const withAuth = (Component) => {
class Auth extends React.Component {
@meetzaveri
meetzaveri / react_component_to_render_lists.md
Last active June 20, 2018 06:01
react_component_to_render_lists #react

React component that renders multiple users(as lists) and having

const listusers = modifiedArr.map((user, index) => <tr key={index}>
        <td>
          <input
            name={`checkbox${index}`}
            type="radio"
@meetzaveri
meetzaveri / imageinputform.md
Created June 21, 2018 05:41
image Input form #react
import React, {Fragment} from "react";

class FileInput extends React.Component {

 render() {