Skip to content

Instantly share code, notes, and snippets.

View meetzaveri's full-sized avatar

Meet Zaveri meetzaveri

View GitHub Profile

JS caveats

  • Delete Array.prototype.push and push method will not work for all arrays.
  • As you can call function before and define it after in the program it'll work, but defining prototype methods after and calling it before will throw 'not a function' error
function foo(a){
 this.a =  a;
}

Code for deleting and creating records in bulk

const AWS = require('aws-sdk');
const Sequelize = require('sequelize');

AWS
  .config

On handling image and then converting into blob

onHandelUpdateProfileUserAvatar = event => {
    // const target = event.target; const value = event.target.value;
    event.preventDefault();
    // console.log("this.state.fileInput", this.state.fileInput,
 // this.state.fileInput.files[0]);
@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() {
@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"

Auth Wrapper for react :

withAuth.js

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

export const withAuth = (Component) => {
class Auth extends React.Component {
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)
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
@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 = {