Skip to content

Instantly share code, notes, and snippets.

View d3ep4k's full-sized avatar
🏠
Working from home

Deepak Mishra d3ep4k

🏠
Working from home
View GitHub Profile
@d3ep4k
d3ep4k / java-pass-by-value.groovy
Created November 5, 2018 08:22
Java is pass by value. You cannot change the reference
map = new HashMap();
map.put("name","intellect");
void modify(map){
map.get("name")
map.put("name","trade");
map = new HashMap();
map.put("name","scf");
}
@d3ep4k
d3ep4k / metamug-json-dataset-datatable.js
Last active May 9, 2018 10:25
Populate datatable with metamug json-dataset datatype
$.ajax({
"url": "https://wondrx.metamug.net/movies/v1.0/movies",
beforeSend: function(xhr){
xhr.setRequestHeader('Accept', 'application/json+dataset');
},
"success": function (json) {
$("#movieList").dataTable( {
"aaData": json.dataset
});
<Request method="GET">
<XRequest url="https://api.url.com/fetch" persist="true" method="POST" classname="com.mycompany.handler.APIResponseHandler">
<Param name="email" value="john.doe@metamug.com"/>
<Header name="Authorization" value="Bearer 7vaBhK323fau0H32fabbgOhcsiGAIgv"/>
<Param name="foo">Some really long value that I want to send </Param>
<Header name="Content-Type">application/json</Header>
</XRequest>
<Query>
@d3ep4k
d3ep4k / mtg-post-request.js
Created September 21, 2017 10:49
AJAX POST Metamug
var ajax = new XMLHttpRequest();
ajax.open('POST','https://api.metamug.com/backend/v1.0/resource');
ajax.onload=function(){
console.log(xhr.responseText);
}
ajax.send();
@d3ep4k
d3ep4k / neuralnet.groovy
Created August 5, 2017 21:22
Neuroph Example
@Grab('org.beykery:neuroph:2.92')
import org.neuroph.core.*;
import org.neuroph.nnet.Perceptron
import org.neuroph.core.data.*
NeuralNetwork neuralNetwork = new Perceptron(2, 1);
DataSet trainingSet = new DataSet(2, 1)
@d3ep4k
d3ep4k / jgit.bat
Created August 2, 2017 12:54
JGit Batch File for easy access
java -jar C:/jgit/sh/file/location/jgit.sh %*
@d3ep4k
d3ep4k / write-xml.groovy
Created July 31, 2017 17:00
Create xml in java
import org.w3c.dom.*;
import javax.xml.parsers.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.*;
import javax.xml.transform.stream.*;
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
//root elements
@d3ep4k
d3ep4k / create.sql
Created June 21, 2017 07:13
Create Table with update and create timestamp
CREATE TABLE `msgs` (
`id` INT PRIMARY KEY AUTO_INCREMENT,
`msg` VARCHAR(256),
`ts_create` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
`ts_update` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
)
@d3ep4k
d3ep4k / jquery-form-processing-metamug.html
Created June 13, 2017 05:52
jquery form processing-metamug html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>FORM PROCESSING</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
</head>
<body style="padding:4em;">