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
​def f(x){ // we are taking equation as x^3+x-1
def f = 2*x + x - 1;
return f;
}
def secant(x1, x2, E) {
def n = 0, xm, x0, c;
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.resize-drag{
z-index:200;
position:absolute;
border: 2px dashed #ccc;
}
.out-container-content ,.container-content{
@d3ep4k
d3ep4k / HourGlass.java
Last active September 18, 2023 14:45
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.EventQueue;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.geom.Area;
import java.awt.geom.GeneralPath;
const searchBox = document.getElementById('searchbox');
const dropdownMenu = document.getElementById('dropdown-menu');
const searchBoxContainer = document.getElementById('searchbox-container');
searchBox.addEventListener("keyup", function(event) {
const timer = setTimeout(function () {
var sr = event.target.value;
if(!sr) return; //Do nothing for empty value
searchBoxContainer.classList.add("control", "is-loading");
var TreeFolder = React.createClass({
getInitialState: function() {
return { showFolderContents: this.props.showFolderContents, node: this.props.node};
},
onClick: function() {
this.setState({ showFolderContents: !this.state.showFolderContents });
},
updateData: function(data){
this.setState({node:data})
@d3ep4k
d3ep4k / paytm-orders-export.js
Last active March 12, 2020 12:43
JS code to organise paytm orders to be exported as csv
// records = []
columns = []
document.querySelectorAll("._2PmH5").forEach( record => {
columns=[]
record.childNodes.forEach( column =>
columns.push(column.textContent.trim())
);
str = JSON.stringify(columns);
// debugger;
// console.log(str)
<jsp:directive.include file="../fragments/mason-init.jspf"/>
<m:resource>
<m:request method="GET">
<sql:query var="result" dataSource="${datasource}">
SELECT * FROM movie
</sql:query>
<c:set target="${output}" property="output" value="${result}"/>
</m:request>
@d3ep4k
d3ep4k / external.xml
Last active June 23, 2019 08:39
External API request example using XRequest feature in metamug console
<?xml version="1.0" encoding="UTF-8" ?>
<Resource xmlns="http://xml.metamug.net/resource/1.0" v="1.0">
<Request method="GET">
<XRequest id="xrequest" method="GET"
url="https://postman-echo.com/get?foo1=bar1&amp;foo2=bar2"
/>
</Request>
</Resource>
@d3ep4k
d3ep4k / hello.xml
Last active June 23, 2019 07:36
When condition example with param example
<?xml version="1.0" encoding="UTF-8" ?>
<Resource xmlns="http://xml.metamug.net/resource/1.0" v="1.0">
<Request method="GET">
<Desc> Say hello to different species </Desc>
<Param name="type" type="text" minlength="1" />
<!-- http://localhost:7000/backend/v1.0/hello?type=animal -->
<Sql id="helloAnimals" when="$type eq animal"> SELECT 'Hello animals' as "message" </Sql>
<!-- http://localhost:7000/backend/v1.0/hello?type=plant -->
<Sql id="helloPlants" when="$type eq plant"> SELECT 'Hello plants' as "message" </Sql>
</Request>
GroovyScriptEngine engine = new GroovyScriptEngine(".");
Map<String, String> request = new HashMap();
request.put("param1", "Hello");
Map<String, String> response = new HashMap();
response.put("param1", "World");
Binding binding = new Binding();
binding.setVariable("request", request);
binding.setVariable("response", response);
engine.run("src/main/java/"+className, binding);