Skip to content

Instantly share code, notes, and snippets.

View smhatre59's full-sized avatar

Saurabh Mhatre smhatre59

View GitHub Profile
sampleTuple = (12, 10, 14, 18, 20, 22, 12)
#print a tuple
print(sampleTuple)
#Output: (12, 10, 14, 18, 20, 22, 12)
#print number of times 12 appears in the tuple
print(sampleTuple.count(12))
#Output: 2
@smhatre59
smhatre59 / User welcome screen
Created May 31, 2017 03:14
Screen to be displayed on first app launch
import React, { Component, PropTypes } from "react";
import {
AsyncStorage,
Modal,
View,
Text,
TouchableHighlight
} from "react-native";
import styles from "./styles/ftreScreenStyles";
export default class FtueScreen extends Component {
@smhatre59
smhatre59 / cloudinarynodejsscript
Last active May 4, 2017 17:08
Nodejs script to upload files to cloudinary cdn
/*
Purpose:Upload files to cloudinary cdn from nodejs
Tutorial:http://wp.me/p82htC-eX
*/
const express = require('express');
let app = express();
const chokidar = require('chokidar');
const filepath = '/home/saurabh/Pictures/Apps/';
let watcher = chokidar.watch(filepath, {
@smhatre59
smhatre59 / initialStateProject365.js
Created May 3, 2017 01:50
Inital State for redux reducer
import topicsJson from '../dbstore/topics.json';
const topicData = topicsJson.topics;
let topicNames = [];
for (var i in topicData) {
topicNames.push({
topicName: topicData[i].topicName,
topicDescription: topicData[i].topicDescription,
topicSummary: topicData[i].topicSummary,
imageurl: topicData[i].imageurl,
topicCategory: topicData[i].topicCategory,
@smhatre59
smhatre59 / fileuploadroute.js
Last active October 23, 2018 23:43
file upload module
var fs = require("fs");
var path = require('path');
var writePath = '/home/saurabh/Documents/';
var cmd=require('node-cmd');
var async = require('async');
var jsonfile = require('jsonfile');
exports.fileupload = function(req,res){
// console.log("req",req.files);
var filesArray = req.files;
@smhatre59
smhatre59 / fileupload.js
Last active July 1, 2020 19:24
File upload using reactjs
import React, { Component } from 'react';
import './App.css';
/*
Screen:LoginScreen
Loginscreen is the main screen which the user is shown on first visit to page and after
hitting logout
*/
import LoginScreen from './Loginscreen';
/*
Module:Material-UI
.username {
margin: auto;
color: #658585;
font-size: 1.53em;
font-family: "Coda", sans-serif;
font-weight: bold;
}
.avatar {
padding: .7em;
import React from "react";
import ReactDOM from "react-dom"
export default class User extends React.Component{
render(){
// console.log("userprops",this.props);
return (
<div>
<img src={this.props.avatar} className="avatar"/>
import React from "react";
import ReactDOM from "react-dom";
import User from './User.js';
export default class UserList extends React.Component{
render(){
if(Object.getOwnPropertyNames(this.props.users).length === 0){
return (<div></div>)
}
var userNodes = this.props.users.map(function(user){
import React from "react";
import ReactDOM from "react-dom";
import {connect} from "react-redux";
import UserList from './UserList.js'
import {fetchUsers} from "../actions/userActions.js"
@connect((store) => {
// console.log("ins store",store.userReducer.users);
return {