Skip to content

Instantly share code, notes, and snippets.

View deepakkadarivel's full-sized avatar

Deepak Kadari Velu deepakkadarivel

  • Relay42
  • Amsterdam
View GitHub Profile
@deepakkadarivel
deepakkadarivel / difference.js
Created January 31, 2020 10:40 — forked from Yimiprod/difference.js
Deep diff between two object, using lodash
/**
* Deep diff between two object, using lodash
* @param {Object} object Object compared
* @param {Object} base Object to compare with
* @return {Object} Return a new object who represent the diff
*/
function difference(object, base) {
function changes(object, base) {
return _.transform(object, function(result, value, key) {
if (!_.isEqual(value, base[key])) {
@deepakkadarivel
deepakkadarivel / index.html
Created October 19, 2018 09:21
Validation logic check. [add your bin description] // source https://jsbin.com/gelidak
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="[add your bin description]">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Validation logic check.</title>
</head>
<body>
@deepakkadarivel
deepakkadarivel / media-query.css
Created August 3, 2018 05:43 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
@deepakkadarivel
deepakkadarivel / gist:1c6135eafdbc0f8d8051a7a7f6e514db
Created February 1, 2018 08:56 — forked from ehuynh/gist:2572398
Start and Stop Jenkins on OSX
# start
sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist
# stop
sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist
@deepakkadarivel
deepakkadarivel / regex-yyyy-mm-dd.js
Created January 4, 2018 10:46 — forked from m-coding/regex-yyyy-mm-dd.js
javascript regex to match date pattern YYYY-MM-DD
// allows YYYY/M/D and periods instead of slashes
// http://stackoverflow.com/questions/24989065/trying-to-validate-yyyy-mm-dd
/^\d{4}[\/.]\d{1,2}[\/.]\d{1,2}$/
// YYYY-MM-DD and YYYY-M-D
// http://stackoverflow.com/questions/6177975/how-to-validate-date-with-format-mm-dd-yyyy-in-javascript
/^\d{4}\-\d{1,2}\-\d{1,2}$/
// YYYY-MM-DD
// https://gist.github.com/arth2o/8471150
@deepakkadarivel
deepakkadarivel / isValidDate - javascript
Created January 4, 2018 09:25 — forked from arth2o/isValidDate - javascript
Javascript function: validate date (yyyy-mm-dd) format via JavaScript.
/**
* isValidDate(str)
* @param string str value yyyy-mm-dd
* @return boolean true or false
* IF date is valid return true
*/
function isValidDate(str){
// STRING FORMAT yyyy-mm-dd
if(str=="" || str==null){return false;}
@deepakkadarivel
deepakkadarivel / app.js
Created December 6, 2017 08:51 — forked from joshnuss/app.js
Express.js role-based permissions middleware
// the main app file
import express from "express";
import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db)
import authenticate from "./authentication"; // middleware for doing authentication
import permit from "./permission"; // middleware for checking if user's role is permitted to make request
const app = express(),
api = express.Router();
// first middleware will setup db connection
@deepakkadarivel
deepakkadarivel / read_line.go
Created November 12, 2017 09:28 — forked from kendellfab/read_line.go
Golang --> Read file line by line.
func readLine(path string) {
inFile, _ := os.Open(path)
defer inFile.Close()
scanner := bufio.NewScanner(inFile)
scanner.Split(bufio.ScanLines)
for scanner.Scan() {
fmt.Println(scanner.Text())
}
}
@deepakkadarivel
deepakkadarivel / main.go
Created November 11, 2017 14:13 — forked from eduncan911/main.go
Go/Reading Console Inputs
package main
import (
"bufio"
"fmt"
"os"
"strings"
)
func main() {
@deepakkadarivel
deepakkadarivel / .eslintrc.js
Created June 22, 2017 07:18 — forked from nkbt/.eslintrc.js
Strict ESLint config for React, ES6 (based on Airbnb Code style)
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"plugins": ["react"],
"ecmaFeatures": {