This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Convert the ResultSet to a List of Maps, where each Map represents a row with columnNames and columValues | |
* @param rs | |
* @return | |
* @throws SQLException | |
*/ | |
private List<Map<String, Object>> resultSetToList(ResultSet rs) throws SQLException { | |
ResultSetMetaData md = rs.getMetaData(); | |
int columns = md.getColumnCount(); | |
List<Map<String, Object>> rows = new ArrayList<Map<String, Object>>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const watermark = require('./watermark'); | |
const path = `assets/target.png`; | |
const w = 500; | |
const h = 500; | |
watermark.drawWatermarkAsBuffer(path, './assets/watermark_source.png', w, h).then(buffer => { | |
require("fs").writeFile("assets/output.png", buffer, 'base64', function(err) { | |
console.log(err); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { createCanvas, loadImage } = require('canvas'); | |
const drawWatermarkAsBuffer = (pathOfSourceImageFile, pathOfWaterMarkImageFile, width, height) => { | |
const canvas = createCanvas(width, height); | |
const ctx = canvas.getContext('2d'); | |
// loading the source image file | |
return loadImage(pathOfSourceImageFile).then(loadSourceImage => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
const FunctionalComponent = props => { | |
const [email, setEmail] = React.useState(''); | |
const [password, setPassword] = React.useState(''); | |
return ( | |
<form> | |
<input type="email" name="email" onChange={e => setEmail(e.target.value)}/> | |
<input type="password" name="password" onChange={e => setPassword(e.target.value)} /> | |
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Old way to create a function | |
function doSomething() { | |
console.log("Inside the old function"); | |
} | |
// New ES6 way to create a function | |
const doSomething = () => { | |
console.log("Inside the new function"); | |
} |