Skip to content

Instantly share code, notes, and snippets.

View devarajchidambaram's full-sized avatar

devaraj devarajchidambaram

View GitHub Profile
@devarajchidambaram
devarajchidambaram / Minio.js
Created November 26, 2019 10:39
Minio object storage server
var Minio = require('minio')
// Instantiate the minio client with the endpoint
// and access keys as shown below.
var minioClient = new Minio.Client({
endPoint: 'localhost',
port: 9000,
useSSL: false,
accessKey: '0OPKIKKR058HTBYXV2JA',
secretKey: 'oT7jT9a0u5UTWoNW5nU+wMdE3lfRtwL5B0FZVRVu'
@devarajchidambaram
devarajchidambaram / index.js
Created November 22, 2019 09:23
React pass value from CHILD => Parent
import React,{Component} from 'react'
import logo from './logo.svg';
import Contact from './Contacts'
class App extends React.Component {
//Pass the callback in the props
constructor(props){
super(props)
this.state = {
contacts : [
@devarajchidambaram
devarajchidambaram / index.js
Created November 22, 2019 09:23
React pass value from CHILD => Parent
import React,{Component} from 'react'
import logo from './logo.svg';
import Contact from './Contacts'
class App extends React.Component {
//Pass the callback in the props
constructor(props){
super(props)
this.state = {
contacts : [
@devarajchidambaram
devarajchidambaram / Method
Created November 7, 2019 09:39
method Override
Following four HTTP methods are commonly used in REST.
• GET - This is to provide a read-only access to resource.
• PUT - This is to create a new resource
• DELETE - This is to remove a resource
• POST - This is to update a existing resource or create a new resource.
When we try to use PUT and DELETE in HTML, we have a problem. Browsers do support PUT and DELETE but it only by using request via AJAX, but not via 'HTML form' submission.
https://dev.to/moz5691/method-override-for-put-and-delete-in-html-3fp2
@devarajchidambaram
devarajchidambaram / index.js
Created October 31, 2019 06:17
Promises all
async function timerTask(){
let [data1, data2] = await Promise.all([
new Promise(function(resolve , reject){
setTimeout(()=>{
resolve('data1!')
}, 1000)
@devarajchidambaram
devarajchidambaram / index.js
Created October 30, 2019 11:45
get month string from js
let date = new Date()
date.toLocaleString('default', { month: 'short' }) //narrow , long short available
@devarajchidambaram
devarajchidambaram / status code.txt
Created October 25, 2019 05:39
List of status codes
200- OK; Standard response for successful HTTP requests
201- Created; Request has been fulfilled. New resource created
204- No Content; Request processed. No content returned
301- Moved Permanently; This and all future requests directed to the given URI
304- Not Modified; Resource has not been modified since last requested
400- Bad Request; Request cannot be fulfilled due to bad syntax
401- Unauthorized; Authentication is possible, but has failed
403- Forbidden; Server refuses to respond to request
404- Not Found; Requested resource could not be found
500- Internal Server Error; Generic error message when server fails
@devarajchidambaram
devarajchidambaram / arrow.js
Last active October 21, 2019 11:48
ES6 modules learning
var evens = [2,4,6,8,10];
var odds = evens.map(v=>v+1)
var pairs = evens.map(value => ({even : value , odd :value+1}))
console.log('odds', pairs)
//This works differntly in arrow function
var object = {
@devarajchidambaram
devarajchidambaram / index.js
Created October 19, 2019 10:25
print object in nodejs
const myObject = {
"a":"a",
"b":{
"c":"c",
"d":{
"e":"e",
"f":{
"g":"g",
"h":{
"i":"i"
@devarajchidambaram
devarajchidambaram / index.txt
Created September 23, 2019 12:34
Common Node.js deployment problems
Common Node.js deployment problems
Problems occurring in Node.js application deployments can have a range of symptoms, but can generally be categorized into the following:
Uncaught exception or error event in JavaScript code
Excessive memory usage, which may result in an out-of-memory error
Unresponsive application, possibly looping or hanging
Poor performance
Crash or abort in native code
Unexpected application behavior or functional issue